I am trying to send a post request using Axios and I also want to access the data from the server. My code is
axios({
method: 'post',
url: '/register/',
headers: {'Content-Type' : 'application/json'},
body: JSON.stringify({fname, lname, username, email, pass})
})
.then((res) => {
console.log(res)
})
.catch(err => {
console.log(err)
})
// and my backend code is
const express = require('express')
const router = express.Router()
router.post('/', async (req, res, next) => {
const firstname = ''
})
Request is send properly and my server also accepts the request. but i do not know how to get the values from my server.
please help me. code is working fine just help me in getting the values on server side code