Simple file server
servst-cli - CLI for this module
npm install --save servst
var http = require('http');
var servst = require('servst');
var statics = servst(__dirname + '/static');
http.createServer(function(req, res) {
statics(req, res, function(err) {
if (err) {
res.writeHead(404, {'Content-Type': 'text/plain'});
res.end('Not found');
}
});
}).listen(3000);
With express
var express = require('express');
var servst = require('servst');
var app = express();
var statics = servst(__dirname + '/static');
app.use(statics);
app.listen(3000);
MIT