Tuesday, April 7, 2015

NodeJs Quick File Server


Installation
$ npm install finalhandler

API
var finalhandler = require(‘finalhandler’);

Example
var http = require('http');
var finalhandler = require('finalhandler');

var serveStatic = require('serve-static');
var serve = serveStatic("./");
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
serve(req, res, done)
});

server.listen(8000);

API Details

No comments:

Post a Comment