This property represents an object that contains cookies
sent by the request. You should use cookie-parser middleware to access cookies.
index.js
const express = require('express') var cookieParser = require('cookie-parser') const app = express() app.use(cookieParser()); app.get('/', (req, res) => res.send("Hello World")) app.get('/users', (req,res) => { res.send(req.cookies) }) const port = 3000 app.listen(port, () => console.log(`Application started listening on port ${port}!`));
No comments:
Post a Comment