To get the Node server running locally:
- Clone this repo
- npm install (to install all required dependencies)
- Install MongoDB (instructions) and run it by executing
mongod
- npm run dev (to start the local server)
- NodeJs >= 6.x
- mongoDB
- async - Powerful functions for working with asynchronous JavaScript.
- body-parser - Node.js body parsing middleware.
- cloudinary - For image uploading.
- connect-flash - Flashing messages.
- expressjs - The server for handling and routing HTTP requests.
- ejs - Embedded JavaScript templates for node.
- moment - JS date library for parsing, validating, manipulating, and formatting dates.
- mongoose - For modeling and mapping MongoDB data to javascript
- multer - Image upload.
- nodemailer - Sending recovery password emails.
- passport - For handling user authentication.
app.js
- The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application.middleware/
- This folder contains middlewares for the routes.models/
- This folder contains the schema definitions for our Mongoose models.public/
- This folder contains all the css and part of the js used on the front-end.routes/
- This folder contains the route definitions for our APP.views/
- This folder contains all the front-end and embedded JS templates (ejs) for the app.
NOTE: Do not forget to set the env variables.
- DATABASEURL (mongoDB url)
- ISADMIN (setting admin)
- CLOUDINARY_API_KEY (image upload)
- CLOUDINARY_API_SECRET (image upload)
- GMAILPW (sending recovery email)
In production env, it is not safe to keep the ids and secrets in a file, so you need to set it up via commandline. If you are using heroku checkout how environment variables are set.