You're viewing old version number 4. - Current version
Learning Node.JS Programming
April 2014 - Better late than never, but I should have begun this process a few months ago.
- http://jothut.com/cgi-bin/junco.pl/tag/nodejs
- http://jothut.com/cgi-bin/junco.pl/b/17499/NodeJS-for-newbies
- http://nodejs.org
- https://www.npmjs.org
- http://nodejs.org/docs/v0.4.11/api/http.html#http.request
- http://package.json.nodejitsu.com
- http://inessential.com/2013/12/09/getting_started_with_node_js_for_cocoa_
- http://inessential.com/2013/12/09/getting_started_with_web_services_using_
- http://expressjs.com/4x/api.html
- http://howtonode.org/hello-node
- http://www.2ality.com/2011/12/nodejs-shell-scripting.html
h2. Hello World at Command Prompt
Open up a text file and enter:
@// Call the console.log function.@ @console.log("Hello World");@
Save file as test1.js and then at the command prompt, execute: @node test1.js@
Obviously, that produces: @Hello World@
h2. Hello World HTTP Server
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8000);
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:8000/");@
#nodejs - #programming - #javascript - #howto
From JR's : articles
141 words - 1426 chars
created on
updated on
- #
source
- versions
Related articles
Learning Node.JS Programming - Nov 10, 2014
App idea to learn new code - Mar 10, 2014
Links feb 25, 2017 - Feb 25, 2017
React Native - Nov 01, 2016
NodeJS for newbies - Nov 01, 2013
more >>