create a axios post in https://github.com in javascript

index.tsx
const axios = require('axios');
const url = 'https://api.github.com/your-api-endpoint';

const data = {
  // Add your data to be sent as payload
};

const config = {
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your-access-token'
  }
};

axios.post(url, data, config)
  .then((response) => {
    console.log(`Status: ${response.status}`);
    console.log(response.data);
  })
  .catch((error) => {
    console.error(error);
  });
467 chars
23 lines

related categories

gistlibby LogSnag