After axios.post, response.data only return html code and what I sent is in response.config.data. Moreover, in the server side, console.log is not working but in vscode console, it returns POST /tagSearch 200 95.325 ms - -
I'm using express and nextjs. Plz help me.....
Here's my code.
client side, pages/tagSearch.js
const onClick = () => {
axios.post('http://localhost:3060/tagSearch', {
"id": 7,
"name": 'mango'
},
{
headers: { "Content-Type": `application/json` }
}
)
.then((res) => {
console.log(res);
}
)
}
server side, app.js
var express = require('express');
var app = express();
var tagSearchRouter = require('./routes/tagSearch');
app.use('/tagSearch', tagSearchRouter);
module.exports = app;
server side, routes/tagSearch.js
router.post('/', (req, res) =>{
console.log(req.body);
})