Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

( used for testing ) a sample node.js application with a well-formed package.json that has contains required fields for nodejitsu deployment

Notifications You must be signed in to change notification settings

Marak/hellonode

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hellonode!

the simplest possible http server hello world example in node

features

  • Example package.json
  • Starts up simple httpServer with helloworld

installation

 git clone git://github.com/Marak/hellonode.git
 cd hellonode
 node server.js

Now you should have a listening node.js http server running on port 80

the code

// requires node's http module
var http = require('http');

// creates a new httpServer instance
http.createServer(function (req, res) {
  
  // ^^ this is the callback, or request handler for the httpServer
  
  // respond to the browser, write some headers so the 
  // browser knows what type of content we are sending
  res.writeHead(200, {'Content-Type': 'text/plain'});
  
  // write some content to the browser that your user will see
  res.write('hello, i know nodejitsu.')
  
  // close the response
  res.end();
  
}).listen(80); // the server will listen on port 80

About

( used for testing ) a sample node.js application with a well-formed package.json that has contains required fields for nodejitsu deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.