var bodyParser = require('body-parser')
var app = express()
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
export const app = express();
app.use(express.json());
app.get('/user/:id', (req, res) => {
console.log(req.params.id) // "1234562134654"
})
or
app.get('/user/:user_id', (req, res) => {
console.log(req.params.user_id) // "1234562134654"
})
app.post('/login', (req, res) => {
console.log(req.body.email) // "user@example.com"
console.log(req.body.password) // "helloworld"
})