Node.js, Express, MongoDB & More: The Complete Bootcamp 2020
- Create json file: npm init
- Install express: npm i express@4
- Create the app.js file
- Setting up Express and Basic Routing
- Read the file tours.json an create the get route
- Create the Post,Patch and Delete routes
- Refector the routes
- Applying middlewares
- install morgan: npm i morgan (request logger middleware)
- Define the User router on 3-Routes then create they functions on 2- routes handlers
- Separating the routes Users and Tours
- Create Route Folder
- Controller Folder
- Create server file
- Create param Middleware for get by id on user route
- Create param Middleware for 404 not found on tour route and remove the repeated code
- Create param Middleware for check values price and name (Post tour route)
- Create a Middleware for read static files
- Create the config file and npm i dotenv
- Install eslint and prettier plugins and dependencies: npm i eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-config-airbnb eslint-plugin-node eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react --save-dev
mongo db
- use natours-test
- db.tours.insertOne({ name: "The Forest Hiker", price: 297, rating: 4.7 })
- db.tours.find()
- show dbs
- show collections
- quit()
Querying (Reading)
- db.tours.insertMany([{name: "The Sea Explorer", price: 497, rating:4.8}, {name: "The Snow Adventurer", price: 997, rating: 4.9, difficulty: "easy"}])
- db.tours.find({ price: {$lte: 500}})
- db.tours.find({price: {$lt:500}, rating: {$gte: 4.8} })
- db.tours.find({ $or: [{price: {$lt: 500}}, {rating: {$gte: 4.8}} ]})
Updating Documents
- db.tours.updateOne({name: "The Snow Adventurer"}, {$set: {price: 597} })
- db.tours.updateMany({ price: {$gt: 500}, rating: {$gte: 4.8}}, { $set: {premium: true}})
Delete Documents
- db.tours.deleteMany({ rating: {$lt: 4.8}})
- db.tours.deleteMany({})
- npm i mongoose@5
- npm i validator
- npm i ndb
- npm i bcryptjs
- npm i jsonwebtoken
- npm i nodemailer
- npm i express-rate-limit
- npm i helmet
- npm i express-mongo-sanitize
- npm i xss-clean
- npm i hpp
- node ./dev-data/data/import-dev-data.js --delete
- node ./dev-data/data/import-dev-data.js --import
- npm i pug
- npm i cookie-parser
- npm i parcel-bundler
- npm i axios
- npm i @babel/polyfill