Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

cookies in express js

var cookieParser = require('cookie-parser');
var express = require('express');
var app = express(); 
var PORT = 3000;
   
app.use(cookieParser());
   
app.get('/user', function (req, res) {
  req.cookies.name='Gourav';
  req.cookies.age=12;  
  
  console.log(req.cookies);
  res.send();
});
   
app.listen(PORT, function(err){
    if (err) console.log(err);
    console.log("Server listening on PORT", PORT);
});
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #cookies #express #js
ADD COMMENT
Topic
Name
3+5 =