User accounts and login with express session
- Express for framework
- Mongoose for mongodb Schema
- connect-mongodb-session for session store
- bcrypt for password hashing
- pug for view engine
- bulma for css styling
- axios for ajax request
- localhost:port "browser"
- if none exist, express-session makes a session that express can get to via "req.session"
- check if session id belongs to any users
- yes?: session.auth = true
- no?: goto login session.auth = false
- if auth is false goto login else finish request like goto home page
- New User can create account from /register
- form with fields for at least username and password
- when form submitted a post request is made that..
- checks fields are not empty
- creates new user object(document)
- set new user's session key value to req.session.id
- set req.session.auth = true
- save new user to database
- redirect to main / page