How to run ExpressJS server from browser ?
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.
index.js
// Requiring express.jsconst express = require('express') // Changing the module to object to use its inbuilt functionsconst app = express() // Port number to run the portconst port_no = 5555 // Get request to send the data to the serverapp.get('/' , (req,res) => { res.send('hey geeks!')}) // Server Setupapp.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:




