chingu-voyage7 / Bears-Team-17

CarTalk - A community designed for car enthusiasts | Voyage-7 | https://chingu.io/
5 stars 0 forks source link

Add db models (spintronic) #5

Closed psitronic closed 5 years ago

psitronic commented 5 years ago

Added the following DB models/schemas to the Models folder:

Added the session middleware.

Corresponding collections (including "sessions") will be created in the running DB process.env.MONGODB_URI automatically when the server starts (node server). The data base should already be created. To test I used a local DB on my laptop.

Dependencies were added: "connect-mongo": "^2.0.2", "express": "^4.16.4", "express-session": "^1.15.6", "mongoose": "^5.3.14"

unrealkaii commented 5 years ago

@psitronic , great job. however there are some typos in the code. relating to type being tpye in the model definitions

nikrb commented 5 years ago

@psitronic when I run locally I get Error: secret option required for sessions. Is something missing in (sample).env file?

psitronic commented 5 years ago

For sessions you need SECRET = 'ourTopSecret' in .env. Later it can be a random number... I suppose to have it in order not to log in each time you leave a page.

nikrb commented 5 years ago

@psitronic ok thanx. can you add it to the sample.env or just a temporary thing?

nikrb commented 5 years ago

@psitronic oh hang on, we aren't loggin in yet - do we really need this? If we use passport later that will take care of auth.