Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

req.body empty on posts

// Envirnoment variable
require('dotenv').config()
const express       = require('express')
const port          = process.env.PORT
const app           = express()
const cookieParser = require('cookie-parser')
app.use(express.json())
app.use(cookieParser())
router.post('/profile', (req, res) => {
  console.log(req.body);
});
app.listen(port, () => console.log(`Server listening on ${port}`))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #empty #posts
ADD COMMENT
Topic
Name
3+4 =