Before you go, check out these stories!

Hackernoon logoHow to Build Your First NodeJS Server with ExpressJS by@Mulhern

How to Build Your First NodeJS Server with ExpressJS

Author profile picture


Javascript Enthusiast

Initialize the project:

npm init

Install the necessary dependencies:

npm install express http --save

Create the home script:

touch index.js

Install nodemon:

npm install nodemon -g

Write the server file:

let express = require('express')
let http = require('http')

// Initializes an express app.
let app = express()

// Gets the first route: '/'.
app.get('/', function(req, res) {
// Sends "HELLO WORLD"
    res.send("HELLO WORLD")

// Creates a new http server with app and listens on localhost:8080 in your browser.


Join Hacker Noon

Create your free account to unlock your custom reading experience.