1. Hello World in Node.js
For this step, you first need to follow the instructions found at nodejs.org to get Node working on your machine. After that, there’s not much to do for getting Hello World working.
Create a new “project”
- CD into a new directory
git init
npm init
Get Node to emit Hello World with hard-coded HTML
Create index.js
using the example webserver code from https://nodejs.org.
var http = require('http') http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}) res.end('Hello World index.js on the server') }).listen(1337) console.log('Server running at http://localhost:1337/')