{ "source": "doc/api/synopsis.markdown", "miscs": [ { "textRaw": "Synopsis", "name": "Synopsis", "type": "misc", "desc": "

An example of a [web server][] written with Node.js which responds with\n'Hello World':\n\n

\n
const http = require('http');\n\nhttp.createServer( (request, response) => {\n  response.writeHead(200, {'Content-Type': 'text/plain'});\n  response.end('Hello World\\n');\n}).listen(8124);\n\nconsole.log('Server running at http://127.0.0.1:8124/');
\n

To run the server, put the code into a file called example.js and execute\nit with the node program\n\n

\n
> node example.js\nServer running at http://127.0.0.1:8124/
\n

All of the examples in the documentation can be run similarly.\n\n

\n" } ] }