SlideShare a Scribd company logo
Workshop
@
Ramnshee Infotech
By Jainul Musani
1
SESSION:01
Express JS
ExpressJs
 Express.js is a web framework that could be used
with Node.js.
 Express.js can start an application server
listening on a port in your machine.
 Express.js starts the application in a single
thread and handles HTTP methods like GET, POST,
DELETE, etc., asynchronously.
SESSION:01
Express JS
ExpressJs – Sample Server
 app.js
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send(‘Started Server with ExpressJs FrameWork')
res.end()
})
app.listen(8000)
SESSION:01
Express JS
Install Express.js
 Assuming you’ve already installed Node.js,
 create a directory to hold your application, and make
that your working directory.
C:nodejs> mkdir myapp
C:nodejs> cd myapp
 Use the npm init command to create a package.json file
for your application.
C:nodejs> npm init –y
 Now install Express in the myapp directory and save it
in the dependencies list.
C:nodejs> npm install express –save
SESSION:01
Express JS
Hello world example - Express.Js
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at
http://localhost:${port}`)
})
SESSION:01
Express JS
Run “Hello World”
 Run the app with the following command:
C:nodejs> node app.js
SESSION:01
Express JS
Express.js Routes
 An Express.js Route defines how our Express application
can respond to a client request to with a specific URI (or
path) and a specific HTTP request method (GET, POST,
etc.).
 A basic Express application as shown below.
app.js
var express = require('express')
var app = express()
// start the server
var server = app.listen(8000, function(){
console.log('Listening on port 8000...')
})
SESSION:01
Express JS
Express.js Routes
 Here Express.js Routes come into picture.
app.get('/', function (req, res) {
res.send('This is a basic Example for Express.js')
})
SESSION:01
Express JS
Training Batch - Winter
Express.js Routes app.js
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Home.')
})
app.get('/hello/', function (req, res) {
res.send('Hello page.')
})
app.get('/bye/', function (req, res) {
res.send('Bye page.')
})
var server = app.listen(8000, function(){
console.log('Listening on port 8000...‘) // start the server
})
SESSION:01
Express JS

More Related Content

PPTX
Nodejs Session01
PPTX
NodeJs Session03
PDF
Aws amazon ec2
PPTX
Simple groovy example in mule
PPTX
Introduction to Node.js
PPTX
Mule esb db_2
PPTX
3 Things Everyone Knows About Node JS That You Don't
PPTX
Mule esb db_1
Nodejs Session01
NodeJs Session03
Aws amazon ec2
Simple groovy example in mule
Introduction to Node.js
Mule esb db_2
3 Things Everyone Knows About Node JS That You Don't
Mule esb db_1

What's hot (17)

PPTX
บทที่3
PPTX
Node js introduction
PDF
IMPACT/myGrid Hackathon - Taverna Server as a Portal
PPTX
A slightly advanced introduction to node.js
PDF
An Introduction of Node Package Manager (NPM)
PPTX
Groovy example in mule
PPTX
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
PPTX
G rpc lection1
PDF
Introduction to REST API with Node.js
PDF
Node js first look - 2016
PDF
Netty - anfix tech&beers
PDF
Virtualbox and Mysql
PPTX
Groovy in Mule
PDF
Oracle virtual server-2-t0-3-upgrade
PPTX
Node js for beginners
PDF
Setup Kubernetes with flannel on ubuntu platform
PPT
Node js
บทที่3
Node js introduction
IMPACT/myGrid Hackathon - Taverna Server as a Portal
A slightly advanced introduction to node.js
An Introduction of Node Package Manager (NPM)
Groovy example in mule
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
G rpc lection1
Introduction to REST API with Node.js
Node js first look - 2016
Netty - anfix tech&beers
Virtualbox and Mysql
Groovy in Mule
Oracle virtual server-2-t0-3-upgrade
Node js for beginners
Setup Kubernetes with flannel on ubuntu platform
Node js
Ad

Similar to ExpressJs Session01 (20)

PPTX
Unit 1 Express J for mean stack and mern
PDF
Express: A Jump-Start
PDF
ExpressJS-Introduction.pdf
PPTX
23003468463PPT.pptx
PPTX
Exp framework for this type of communica
PPTX
CH-2.2.1 (1).pptx hisnsmmzmznznNNNMamMamam
PPT
Node.js Express Framework
PPT
nodejs_at_a_glance, understanding java script
PPT
nodejs_at_a_glance.ppt
PPTX
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
PDF
Node.js with Express
ODP
Nodejs Intro - Part2 Introduction to Web Applications
PPTX
Express yourself
PPTX
Building Web Apps with Express
PPTX
Starting with Node.js
PPTX
Switch to Backend 2023 | Day 1 Part 2
PPTX
Node Session - 3
PPTX
Express js
PPTX
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
PDF
Introduction to Node.JS Express
Unit 1 Express J for mean stack and mern
Express: A Jump-Start
ExpressJS-Introduction.pdf
23003468463PPT.pptx
Exp framework for this type of communica
CH-2.2.1 (1).pptx hisnsmmzmznznNNNMamMamam
Node.js Express Framework
nodejs_at_a_glance, understanding java script
nodejs_at_a_glance.ppt
MERN SRTACK WEB DEVELOPMENT NODE JS EXPRESS
Node.js with Express
Nodejs Intro - Part2 Introduction to Web Applications
Express yourself
Building Web Apps with Express
Starting with Node.js
Switch to Backend 2023 | Day 1 Part 2
Node Session - 3
Express js
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
Introduction to Node.JS Express
Ad

More from Jainul Musani (20)

PDF
Core Java Interface Concepts for BCA Studetns
PDF
Java Abstract and Final Class for BCA students
PDF
Java Collection Framework for BCA Students
PDF
Simple Calculator using JavaFx a part of Advance Java
PDF
JavaFx Introduction, Basic JavaFx Architecture
PDF
ASP.NET 2010, WebServices Full Example for BCA Students
PDF
Palindrome Programme in PHP for BCA students
PDF
Leap Year Program in PHP for BCA students
PDF
"PHP and MySQL CRUD Operations for Student Management System"
PDF
Python: The Versatile Programming Language - Introduction
PPTX
Python a Versatile Programming Language - Introduction
PDF
React js t8 - inlinecss
PDF
React js t7 - forms-events
PDF
React js t6 -lifecycle
PDF
React js t5 - state
PDF
React js t4 - components
PDF
React js t3 - es6
PDF
React js t2 - jsx
PDF
React js t1 - introduction
PPTX
NodeJs Session02
Core Java Interface Concepts for BCA Studetns
Java Abstract and Final Class for BCA students
Java Collection Framework for BCA Students
Simple Calculator using JavaFx a part of Advance Java
JavaFx Introduction, Basic JavaFx Architecture
ASP.NET 2010, WebServices Full Example for BCA Students
Palindrome Programme in PHP for BCA students
Leap Year Program in PHP for BCA students
"PHP and MySQL CRUD Operations for Student Management System"
Python: The Versatile Programming Language - Introduction
Python a Versatile Programming Language - Introduction
React js t8 - inlinecss
React js t7 - forms-events
React js t6 -lifecycle
React js t5 - state
React js t4 - components
React js t3 - es6
React js t2 - jsx
React js t1 - introduction
NodeJs Session02

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Machine learning based COVID-19 study performance prediction
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced methodologies resolving dimensionality complications for autism neur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf

ExpressJs Session01

  • 1. Workshop @ Ramnshee Infotech By Jainul Musani 1 SESSION:01 Express JS
  • 2. ExpressJs  Express.js is a web framework that could be used with Node.js.  Express.js can start an application server listening on a port in your machine.  Express.js starts the application in a single thread and handles HTTP methods like GET, POST, DELETE, etc., asynchronously. SESSION:01 Express JS
  • 3. ExpressJs – Sample Server  app.js var express = require('express') var app = express() app.get('/', function (req, res) { res.send(‘Started Server with ExpressJs FrameWork') res.end() }) app.listen(8000) SESSION:01 Express JS
  • 4. Install Express.js  Assuming you’ve already installed Node.js,  create a directory to hold your application, and make that your working directory. C:nodejs> mkdir myapp C:nodejs> cd myapp  Use the npm init command to create a package.json file for your application. C:nodejs> npm init –y  Now install Express in the myapp directory and save it in the dependencies list. C:nodejs> npm install express –save SESSION:01 Express JS
  • 5. Hello world example - Express.Js const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) }) SESSION:01 Express JS
  • 6. Run “Hello World”  Run the app with the following command: C:nodejs> node app.js SESSION:01 Express JS
  • 7. Express.js Routes  An Express.js Route defines how our Express application can respond to a client request to with a specific URI (or path) and a specific HTTP request method (GET, POST, etc.).  A basic Express application as shown below. app.js var express = require('express') var app = express() // start the server var server = app.listen(8000, function(){ console.log('Listening on port 8000...') }) SESSION:01 Express JS
  • 8. Express.js Routes  Here Express.js Routes come into picture. app.get('/', function (req, res) { res.send('This is a basic Example for Express.js') }) SESSION:01 Express JS Training Batch - Winter
  • 9. Express.js Routes app.js var express = require('express') var app = express() app.get('/', function (req, res) { res.send('Home.') }) app.get('/hello/', function (req, res) { res.send('Hello page.') }) app.get('/bye/', function (req, res) { res.send('Bye page.') }) var server = app.listen(8000, function(){ console.log('Listening on port 8000...‘) // start the server }) SESSION:01 Express JS