axios body params get code example
Example 1: axios pass params
const axios = require('axios');
// Equivalent to `axios.get('https://httpbin.org/get?answer=42')`
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });
res.data.args; // { answer: 42 }
Example 2: axios post with body
const body = { a: 10 };
axios.post('/save', body);
// Axios automatically serializes JavaScript objects to JSON
// when passed to the axios.post function as the second parameter.
// This eliminates the need to serialize POST bodies to JSON.