0% found this document useful (0 votes)
23 views2 pages

Express Parameters

Uploaded by

anilaamanat28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Express Parameters

Uploaded by

anilaamanat28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Express intro:

Express js is a Node.js framwork for building APIs, web application and cross-
platform mobile apps.
EXpress is a high performance, fast, unopinionatedm and lightweight.
It is used as a server side scripting lanhuage.
It is used to build a single page, multipage, and hybrid web application.
It's a layer built on the top of the Node js that helps manage servers and routes.

Why Express JS?


Express was created to make APIs and web applications with ease,
It saves a lot of coding time almost by half and still makes web and
mobile applications are efficient.
Another reason for using express is that it is written in javascript as javascript
is an easy language even if you don't have a previous
knowledge of any language. Express lets so many new developers enter the field of
web development.
The reason behind creating an express framework for node js is:

Time-efficient
Fast
Economical
Easy to learn
Asynchronous

Express commands
You can install it using this command:
npm install express-session

first create a new Node.js project with this command: npm init -y

then run:
npm install express

Save this to an index.js file in your project root folder, and start the server
using this command:

node index.js

Request Parameters
I mentioned how the Request object holds all the HTTP request information.

These are the main properties you'll likely use:

Property Description
.app holds a reference to the Express app object
.baseUrl the base path on which the app responds
.body contains the data submitted in the request body (must be parsed and populated
manually before you can access it)
.cookies contains the cookies sent by the request (needs the cookie-parser
middleware)
.hostname the hostname as defined in the Host HTTP header value
.ip the client IP
.method the HTTP method used
.params the route named parameters
.path the URL path
.protocol the request protocol
.query an object containing all the query strings used in the request
.secure true if the request is secure (uses HTTPS)
.signedCookies contains the signed cookies sent by the request (needs the
cookie-parser middleware)
.xhr true if the request is an XMLHttpRequest

You might also like