I need your help on building rest API using express.. I have tried many versions of express. that also have CookieParser middleware but I'm just getting the above error...
Error: Cannot find module 'cookie'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)`
I installed the cookie-parser globally and using Express version 4.... the code snippet is below.
var express = require('express'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
session = require('express-session'),
mongoose = require('mongoose'),
api = require('./routes/api.js') ,
app = express();
app.use(session({ secret: 'angcms', saveUninitialized: true, resave: true })); app.use(cookieParser());