Stop
Simplified express for static websites.
Stop offers an API similar to express and is compatible with express middleware, but can automatically generate a static version of any website.
Example
var Stop = require('stop');
var app = new Stop(isStatic);
app.get('/foo', function (req, res, next) {
res.send('bar');
});
app.directory('/', __dirname + '/public');
app.get('/client.js', require('browserify-middleware')('./client.js'))
app.run('./out', 3000);
API
new Stop(isStatic)
Must be called as a constructor. The isStatic property determines
Stop#get(path, middleware...)
Define a custom route from path to middleware. You can have any code you like in middlware, which is where the real power of Stop comes form.
Paths for "directories" will become "index.html" when compiled statically.
Stop#favicon(filepath)
Use the favicon at filepath to respond to all requests for /favicon.ico
Stop#file(path, filepath)
Serve the file at filepath for all requests for path.
Stop#directory(path, filepath)
Serve the files in the directory filepath for requests for path/*.
Stop#run(path, port)
Port is optional and a default one will be used if left out. This either compiles the server statically or runs it dynamically. It also sets NODE_ENV to production if true, so that anything that supports automated minification knows to enable it.
License
MIT
If you find it useful, a payment via gittip would be appreciated.
