https://github.com/marak/hellonode
( used for testing ) a sample node.js application with a well-formed package.json that has contains required fields for nodejitsu deployment
https://github.com/marak/hellonode
Last synced: about 1 year ago
JSON representation
( used for testing ) a sample node.js application with a well-formed package.json that has contains required fields for nodejitsu deployment
- Host: GitHub
- URL: https://github.com/marak/hellonode
- Owner: Marak
- Created: 2010-04-24T23:56:42.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2016-12-27T11:27:15.000Z (over 9 years ago)
- Last Synced: 2024-10-29T11:12:39.141Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 808 KB
- Stars: 20
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# 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