npm start
listening on port 3000- Uses
dotenv
package for environment variables in.env
file - Uses
ejs
templating engine
bcryptjs: ^2.4.3
connect-flash: ^0.1.1
connect-mongodb-session: ^2.1.1
csurf: ^1.10.0
dotenv: ^7.0.0
ejs: ^2.6.1
express: ^4.16.4
express-session: ^1.16.1
helmet: ^3.16.0
mongoose: ^5.5.5
nodemailer: ^6.1.1
- Database:
udemy
on MongoDB Atlas - Collections:
ms1214prods
,ms1214users
,ms1214orders
,ms12sessions
- Stores cart info as embedded document in
ms1214users
- Stores cart info as embedded document in
- Uses
express-session
package to store session id in default cookieconnect.sid
- Uses
connect-mongodb-session
package to store session data in database - Stores user info and
isLoggedIn
flag inreq.session
object - Stores
mongoose
user instance inreq.user
to get access to instance methods - Data for
req.user
obtained fromreq.session.user
- Adds
signup
link, page, and routes - Removes creating default user on startup
- Encrypts password with
bcryptjs
package - Protects routes by checking
req.session.isLoggedIn
inmiddleware/isAuth
middleware - Sets
req.user
fromreq.session.user
in middleware file middleware/setLocals.js
middleware- sets local variable
isLoggedIn
for views - sets local variable
csrfToken
for views withinput
fields named_csrf
(csurf
package)
- sets local variable
- Flashes messages with
connect-flash
package - Sends email with
nodemailer
package throughmailtrap.io
- Adds password reset link, page, and routes
- Uses
crypto
package to create token for password reset email throughmailtrap.io
- Adds form to change password
- Adds authorization to admin (edit and delete) user's own products only