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

20 Replies, 674 Views

Honestly? For how to send data to api in javascript node, just use `axios`. It’s got:
- Promise support
- Auto JSON parsing
- Timeout settings
- Interceptors (for auth, logging, etc.)

```javascript
axios.post('/api', { data }, { timeout: 5000 })
.then(...)
.catch(...);
```

Why make life harder?

Messages In This Thread



Users browsing this thread: 1 Guest(s)