From 0800c0aa7275bf389b157e1568fa61b59285ad86 Mon Sep 17 00:00:00 2001 From: Robert Jefe Lindstaedt Date: Thu, 21 Apr 2016 00:12:40 +0200 Subject: doc: git mv to .md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc: rename .markdown references in content * doc: rename to .md in tools * doc: rename to .md in CONTRIBUTING.md PR-URL: https://github.com/nodejs/node/pull/4747 Reviewed-By: Myles Borins Reviewed-By: techjeffharris Reviewed-By: Johan Bergström Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/synopsis.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 doc/api/synopsis.md (limited to 'doc/api/synopsis.md') diff --git a/doc/api/synopsis.md b/doc/api/synopsis.md new file mode 100644 index 00000000000..7dd3b8fe99d --- /dev/null +++ b/doc/api/synopsis.md @@ -0,0 +1,29 @@ +# Synopsis + + + +An example of a [web server][] written with Node.js which responds with +`'Hello World'`: + +```js +const http = require('http'); + +http.createServer( (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. + +[web server]: http.html -- cgit v1.2.3