Node.
js
Express
Presentation By
Somasundaram S
CSB19095
25/05/2021 Pg:1
[Link] is a server side JavaScript environment that uses an
asynchronous event driven model. This allows [Link] to
get excellent performance based on the architectures of
many Internet applications.
[Link] uses an event-driven, non-blocking I/O model that
makes it lightweight and efficient. [Link]’ package
ecosystem, npm, is the largest ecosystem of open source libraries
in the world.
Pg:2
Express is a minimal and flexible [Link] web application
framework that provides a robust set of features for web and
mobile applications.
[Link] is used for creating server side of web
application.
Pg:3
How to install?
Firstly, install the Express framework globally using NPM
so that it can be used to create a web application using
node terminal.
$ npm install express
You should install the following important modules along
with express −
$ npm install body-parser
$ npm install cookie-parser
$ npm install multer
Pg:4
NPM - Node Package Manager
Node Package Manager (NPM) is a command line tool that installs,
updates or uninstalls [Link] packages in your application. The node
community around the world creates useful modules and publishes
them as packages in this repository.
NPM is included with [Link] installation.
Pg:5
Creating an Express Server
Now that Express is installed, create a new [Link] file and open it
with your code editor.
The first line here is grabbing the main Express module from the
package you installed.
Pg:6
These lines of code is where we tell our Express server how to
handle a GET request to our server.
Here, we are calling a function on res to send back a
response: ’Successful response.’
Pg:7
Finally, once we’ve set up our requests, we must start our server! We
are passing 3000 into the listen function, which tells the app which port
to listen on.
Pg:8
Revisit your terminal window and run your application:
$ node [Link]
Then, visit localhost : 3000 in your web browser, Your browser
window will display: “Successful response”.
Your terminal window will display:
“Example app is listening on port 3000”,
Pg:9
Pg:10