create a axios post in javascript

index.tsx
const axios = require('axios');

axios.post('https://api.example.com/post-endpoint', {
  key1: 'value1',
  key2: 'value2'
})
.then(response => {
  console.log('Response: ', response.data);
})
.catch(error => {
  console.error('Error: ', error);
});
249 chars
13 lines

related categories

gistlibby LogSnag