0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/doc/api/synopsis.markdown
cjihrig 3b602527d1 node: additional cleanup for node rename
Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-08-23 17:59:43 -04:00

24 lines
630 B
Markdown

# Synopsis
<!--type=misc-->
An example of a [web server](http.html) written with Node.js which responds with
'Hello World':
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
To run the server, put the code into a file called `example.js` and execute
it with the node program
> node example.js
Server running at http://127.0.0.1:8124/
All of the examples in the documentation can be run similarly.