How to Send Data to API in JavaScript Node – Best Practices? or What’s the Right Way to Send Data to

20 Replies, 586 Views

For how to send data to api in javascript node, I like `superagent`. It’s super clean:

```javascript
const superagent = require('superagent');

superagent
.post('/api')
.send({ name: 'John' })
.then(res => console.log(res.body))
.catch(err => console.log(err.status));
```

Plus, it has plugins for retries, caching, etc.



Users browsing this thread: 1 Guest(s)