diff options
author | Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> | 2016-04-21 00:12:40 +0200 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-04-20 16:34:27 -0700 |
commit | 0800c0aa7275bf389b157e1568fa61b59285ad86 (patch) | |
tree | a0b739491c4b0170fc333b1b57d61e6d7ae1ca58 /doc/api/synopsis.md | |
parent | cff2a137f201604cbb3c4e54578b4ebfd20bcaf2 (diff) | |
download | android-node-v8-0800c0aa7275bf389b157e1568fa61b59285ad86.tar.gz android-node-v8-0800c0aa7275bf389b157e1568fa61b59285ad86.tar.bz2 android-node-v8-0800c0aa7275bf389b157e1568fa61b59285ad86.zip |
doc: git mv to .md
* 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 <myles.borins@gmail.com>
Reviewed-By: techjeffharris
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'doc/api/synopsis.md')
-rw-r--r-- | doc/api/synopsis.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/api/synopsis.md b/doc/api/synopsis.md new file mode 100644 index 0000000000..7dd3b8fe99 --- /dev/null +++ b/doc/api/synopsis.md @@ -0,0 +1,29 @@ +# Synopsis + +<!--type=misc--> + +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 |