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”

  1. CD into a new directory
  2. git init
  3. 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 Worldindex.js on the server')
    console.log('Server running at http://localhost:1337/')

Next » Using React’s JSX Syntax