Backend Course
Backend Course
Client Database
Request
Response Server
VIRTUAL CODE
ULTIMATE
BACKEND
COURSE
Set-UP Node JS
Install Node JS
Install npm
Create folder
ULTIMATE
BACKEND
COURSE
- Example-
Routing In Node JS -
- Routing is the process of defining how an application
responds to different client requests based on the URL
( or Route )
ULTIMATE
BACKEND
COURSE
HTTP Method
VIRTUAL CODE
Level-3 Introduction to Express JS
HTTP methods-
- HTTP methods are used to handle various types of requests
made to a server.
req.params -
- req.params is an object that stores route Parameters in
express JS.
- It is used to capture dynamic values from the URL.
VIRTUAL CODE
Level-3 Introduction to Express JS
req.query -
- req.query is an object that stores query parameters from the
URL.
req.query -
VIRTUAL CODE
ULTIMATE
BACKEND
COURSE
ULTIMATE
BACKEND
COURSE
Middlewares–
- Middleware runs before the route handler.
- Middleware must call next() to continue to the next function .
- If Middleware does not call next() , the request will hang.
- There are some built-in , custom , thirdparty middleware etc.
Built-in Middleware
custom Middleware
VIRTUAL CODE
Level-5 Middleware, Status Code and HTTP Headers
Status Code –
VIRTUAL CODE
Level-5 Middleware, Status Code and HTTP Headers
HTTP Headers–
- HTTP Headers are key-value Pairs used in HTTP requests and
responses to pass additional information between the client and
the server.
HTTP Headers–
- Get request Headers:
ULTIMATE
BACKEND
COURSE
What is Database ? –
A database is a collection of data that allows storing ,managing
and retrieving information efficiently.
MongoDB–
- MongoDB is a NoSQL database that stores data in flexible ,
JSON – like format instead of tables.
NoSQL
ID Name Age
1 Ayush 21
2 Dev 22
SQL
VIRTUAL CODE
Level-6 Introduction to MongoDB
MongoDB–
Document 1
Collection
Document 2
VIRTUAL CODE
Level-6 Introduction to MongoDB
Database
VIRTUAL CODE
Level-6 Introduction to MongoDB
Mongoose –
- Mongoose is an ODM ( Object Data Modeling ) library for
MongoDB and Node JS.
Install mongoose
Connect DB
Design Schema
Schema –
- A Schema in Mongoose defines the structure of documents
within a MongoDB collection .
Model –
- A model is wrapper for schema and provides an interface to
interact with MongoDB Collection.
VIRTUAL CODE
Level-6 Introduction to MongoDB
Schema –
VIRTUAL CODE
Level-6 Introduction to MongoDB
Operation syntax
Create (Insert one) User.create({ })
Create (Insert many) User.insertMany([{ } , { }])
Read (Find All) User.find( )
Read (Find One) User.findOne({ })
Read (Find by ID) User.findById(“id”)
Update (one document) User.updateOne({ } , { })
Update (Find and Update) User.findOneAndUpdate({ },{ },{ })
Delete (One Document) User.deleteOne({ })
Delete ( Many Documents ) User.deleteMany({age : {$lt : 18} })
VIRTUAL CODE
Level-6 Introduction to MongoDB
VIRTUAL CODE
Level-6 Introduction to MongoDB
VIRTUAL CODE
ULTIMATE
BACKEND
COURSE
Authentication –
- Verifies who a user is. ( Login & SignUp using email/password )
Authorization –
- Determines what a user can access .
VIRTUAL CODE
Level-7 Authentication & Authorization
VIRTUAL CODE
Level-7 Authentication & image Upload