search in google:
node.js modules
https://github.com/joyent/node/wiki/modules
to see the whole range of possibilities.
using npm:
as you installed node.js npm is also installed. this is how to use it:
when you start a new project
make an empty folder and put there your file.
it maybe named index.js, it is also the default file name for a module.
in the command prompt enter this new project folder and run:
npm init
if you are laizy then just press many times Enter and thats it, or you can enter your information there.
it will create package.json for you and node_modules folder.
then you can use npm in your program like(run it in your project folder):
npm install --save somepackage
then you can use this package in your program like:
var somepackage=require('somepackage')
npm documentation:
people usually don't use vanilla node.js
- people use "async" module or some promises module. to write a less callback based code. and use simple parallel or serial logic or use async foreach or foreach limit for asynchronious batch processing.
- people use "express" module it is a better equipd http request and http response and http server. it has
./node_modules/express/bin/express --help
command that can generate a basic boilerplate.
- the basic structure of the https server callback is function(req,res,next){}
- if you like that you see you process it otherwise you modify what you want and call next to ket the handler to process the request.
- express has basic file server with mimes and everything.
- people use "mysql" module for database