servst

2.0.3 • Public • Published

servst Build Status

Simple file server

servst-cli - CLI for this module

Install

npm install --save servst

Usage

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);

License

MIT

Dependents (1)

Package Sidebar

Install

npm i servst

Weekly Downloads

4

Version

2.0.3

License

MIT

Unpacked Size

6.08 kB

Total Files

10

Last publish

Collaborators

  • andrepolischuk