background preloader

Tutorial

Facebook Twitter

Getting started with node.js. A simple, standardised way of providing Javascript libraries. Define methods to make available to the world using exports. Import modules using require. In a previous slide I mentionded that node.js is easily extensible because it makes use of CommonJS. So what's that? CommonJS is an attempt to expand the standard library provided by the Javascript specification into something that is useful beyond the browser-based world that Javascript is normally confined to. This code example shows how CommonJS can be used. require is a construct used to import Javascript modules. There are other built-in modules for handling things like file I/O (the POSIX module), HTTP servers (there's a server and a client implementation in the HTTP module), generic TCP servers (the TCP module), DNS lookups (the DNS module) and several others. To write your own you define properties on the exports object which are then returned from a require() on that file.

How do I get started with Node.js. Node.js beginner tutorials. The Node Beginner Book » A comprehensive Node.js tutorial. Node.js - Loading basic HTML in NodeJS.

Http server

Nodeapps/http-server. How To Node - NodeJS. Node Tuts - Node.js Video Tutorials. Node.js for Beginners. The Node Beginner Book » A comprehensive Node.js tutorial. Node.js beginner tutorials. How do I get started with Node.js. How do I get started with Node.js.