Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to run ExpressJS server from browser ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Express is the node module which is used to create a server, to take get request on our server. We can run the ExpressJS server from the browser using the following 5 simple steps:

Step 1: Install the Express locally into your system by the following command:

npm install express

Step 2: Check the version of the express server by using the below command in the terminal:

npm ls express

Step 3: Create a file with the name index.js in any project directory.

Step 4: Write down the following code in the index.js file.


// Requiring express.js
const express = require('express')
// Changing the module to object to use its inbuilt functions
const app = express()
// Port number to run the port
const port_no = 5555
// Get request to send the data to the server
app.get('/' , (req,res) => {
    res.send('hey geeks!')
// Server Setup
app.listen(port_no, () => {
    console.log('port running atport number : 5555')

Step 5: Run the application using the following steps.

Run the index.js file using the following command:

node index.js

Output: You will see the following output on console screen.

Now go to your browser and go to http://localhost:5555/  to open the server:

My Personal Notes arrow_drop_up
Last Updated : 31 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials