Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed User Authentication With Express and Mongo!
You have completed User Authentication With Express and Mongo!
Preview
Learn how to install express-session and add it to your application.
Resources
Installing express-session
npm install express-session
Adding express-session to an app
var session = require('express-session');
app.use(session( {
secret: 'treehouse loves you',
resave: true,
saveUninitialized: false
}));
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
cookies to our express application
using the express session module.
0:00
This is a package created by
the express programming team.
0:00
It gives us middleware to handle session
logic in an express application.
0:03
In other words, it saves us from
having to do a lot of programming.
0:07
Let me show you how it works.
0:11
First, in the terminal or console,
I'll switch to my project directory,
0:14
And install expression
session by typing npm
0:20
install express-session --save.
0:25
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up