If you’re struggling with how to send data to api in javascript node, try `got`—it’s like `axios` but lighter and more modern.
```javascript
const got = require('got');
(async () => {
try {
const { body } = await got.post('https://api.example.com', {
json: { hello: 'world' }
});
console.log(body);
} catch (error) {
console.log('Yikes:', error.response.body);
}
})();
```
It even streams responses! Super handy for big data.
```javascript
const got = require('got');
(async () => {
try {
const { body } = await got.post('https://api.example.com', {
json: { hello: 'world' }
});
console.log(body);
} catch (error) {
console.log('Yikes:', error.response.body);
}
})();
```
It even streams responses! Super handy for big data.
