Axios get in url works but with second parameter as object it doesn't
axios.get
accepts a request config as the second parameter (not query string params).
You can use the params
config option to set query string params as follows:
axios.get('/api', { params: { foo: 'bar' }});
On client:
axios.get('/api', { params: { foo: 'bar' } });
On server:
function get(req, res, next) { let param = req.query.foo .....}
This works fine for me. When it is post request nested data object isn't needed but in get requests, in order to send data, you need it.
axios.get('/api', { data: { foo: 'bar' }}