1createCookieInHour: (cookieName, cookieValue, hourToExpire) => {
2 let date = new Date();
3 date.setTime(date.getTime()+(hourToExpire*60*60*1000));
4 document.cookie = cookieName + " = " + cookieValue + "; expires = " +date.toGMTString();
5},
6
7//create any new cookie
8createCookieInHour('cookieName', 'cookieValue', 5);
9
10//view cookies
11let cookie = document.cookie.split(';');
12console.log('cookie : ', cookie);
1// server.jsrequire('@babel/register'); const express = require('express');const serverMiddleware = require('./src/server').default;const cookiesMiddleware = require('universal-cookie-express'); const app = express(); app .use('/assets', express.static('dist')) .use(cookiesMiddleware()) .use(serverMiddleware); app.listen(8080, function() { console.log('Listening on 8080...');});