Week 12th at Jadu

Why should you use Express.js?

$ npm install express --save
var express = require('express');
var app = express();

app.get('/', function (req, res) {
res.send('Hello World');
})

var server = app.listen(3000, function () {
var host = server.address().address
var port = server.address().port

console.log("Example app listening at http://%s:%s", host, port)
})
$ node server.js
Example app listening at http://localhost:3000
  • You can clearly see that we if browse to the URL of localhost on port 3000, you will see the string ‘Hello World’ displayed on the page.
  • Because in our code we have mentioned specifically for the server to listen on port no 3000, we are able to view the output when browsing to this URL

--

--

--

Full Stack Web Developer Tech Enthusiast | Speaker| Writer| DSC Lead | Community Builder| AWS Enthusiast |Find me @ubaidullahrao2

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Showing Ads with Phoenix LiveView

Build a Lead Generator in 5 Minutes with Standard Library

Well explained: Javascript in operator

Use An API To Obtain Wheat Prices In Indian Rupees

Selenium + Node

The Vue.js Master Class & Exciting Technologies

Introducing Material UI schematics

Master of JavaScript Basic to Advanced-2019

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ubaidullah Rao

Ubaidullah Rao

Full Stack Web Developer Tech Enthusiast | Speaker| Writer| DSC Lead | Community Builder| AWS Enthusiast |Find me @ubaidullahrao2

More from Medium

Revolutionize Remote Education with JOUYSING’s Document Camera

How to develop an Uber clone from scratch?

How to Create a Ethereum Sandbox Environment

Top 10 List of Best React Tutorials: Learn React JS for Free in 2022

Free React Tutorials on YouTube