Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Cookies In NodeJS

var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get("/set", function(req, res, next)
{
	res.cookie("a", "hello world");

	res.json({a: req.cookies.a});
});

router.get("/get", function(req, res, next)
{
	res.json({a: req.cookies.a});
});
 

module.exports = router;
 
PREVIOUS NEXT
Tagged: #Cookies #In #NodeJS
ADD COMMENT
Topic
Name
9+1 =