var express = require(‘express’);
var cookieParser = require(‘cookie-parser’);
var session = require(‘express-session’);
var app = express();
app.use(cookieParser());
app.use(session({secret: “Shh, its a secret!”}));
app.get(‘/colour.html’, function(req, res){
if(req.session.page_views == 0){
req.session.page_views++;
res.send(“Red”);
}
else if(req.session.page_views == 1){
req.session.page_views++;
res.send(“Yellow”);
}
else if(req.session.page_views == 2){
req.session.page_views++;
res.send(“Green”);
}
else if(req.session.page_views == 3){
req.session.page_views++;
res.send(“Blue”);
}
else if(req.session.page_views == 4){
req.session.page_views = 0;
res.send(“Red”);
}
});
app.listen(3000);
//Pic below are the codes to index,js, codes from the questionabove are to be added into this file, dont modify the firstrouter.get function, leave it