Hello world with Node.JS 9.1.0 & Express 4.16.*

  • node-express

Sometimes, when you are picking up a new piece of tech it’s hard to get started in it, since some of the things can be quite different to what you are used. The following article and the one that will follow are meant to provide as straightforward solutions as possible, with Github code examples that you can download. All the code example will try to reference the versions or most up to date versions as possible. If you notice an outdated version do feel free to fire up an issue on Github or submit a PR with a fix on it. However for this one there won’t be Github example since it’s really basic, and it’s good to know by heart how to make the simplest of Node.js configs.

Introduction to basic installation of newest Node.JS and Express:

1.) Install Node.JS. Go to: https://nodejs.org/en/ and choose 9.1.0 or the latest Current version. After downloads finishes Install it and just follow the instructions.

2.) Go to your desired project folder and write following commands:

For creation of your project folder and cd-ing into it.
mkdir myapp
cd myapp

This will initialize your package.json. Follow the questions and fill out the info
npm init

3.) When getting prompted for entry point, write index.js instead.

4.) After you finish the init, add express to the list of dependencies:

npm install express --save

5.) In index.js file that you pointed to, and created it, add the following:

const express = require('express')
const app = express()

app.get(‘/’, (req, res) => res.send(‘Hello World!’))

app.listen(3000, () => console.log(‘Example app listening on port 3000!’))

6.) Congrats.


After following all the previous steps
node index.js

and go to http://localhost:3000/

At this point your local machine should have the server setup and running on the above url. You should see a Hello world displaying back at you.

By |November 12th, 2017|Categories: ALL, How to, The Code|

About the Author:

Senior lead developer currently working in Java, architecture design, mix of tech from Front-end in JS and templating to chef,rundeck etc. For fun and challenge I am writing different blog posts from stories to poems, programming tutorials and many more. Currently working on my Masters degree on a part-time basis.