###Preparation
// install global packages
npm install -g grunt-cli
npm install -g express
npm install -g express-generator
npm install -g nodemon
// Add the -e flag to use the EJS template engine
express -e photos
cd photos
npm install mongoose --save
npm install mongodb --save
npm install colors --save
npm install ejs --save
npm install
- Init the local repository
git init
- Create new git repository on github
- Follow the instructions and add the git remote to this local repository
- Create the .gitignore file to ignore all the node_modules
Download mongoDB and copy the files in the bin folder within to wherever you want Mongo to live, and you're done. You've installed Mongo
-
Test the application
DEBUG=photos:* npm start
Open Browser in http://127.0.0.1:3000 You should now see the Welcome page
- Create routes/photos.js and add a list function to list (display) the images
- Create new file views/photos.ejs which will be served as our HTML page to display the images
- Edit app.js and add the photos as required module
- Edit app.js and set the photos list as our default view
- restart the node server and reload the page
npm install --save multer
- Create file models/Photo.js with the photos model
- Update the
exports.list
to fetch the images from the mongod db
- Create file models/Photo.js
- Creating a photo upload form (views/photos/upload.ejs)
- Add the new routes to app.js
- Add the upload form (views/photos/upload.ejs)
- Adding photo submit route definition
- Add photo upload destination settings (app.js)
- Update the models/Photo.js with the download method
- Add the new routes to app.js
- Update the view to support the download method