Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Middleware

dsc edited this page Jul 19, 2012 · 1 revision

Limn is an Express application, allowing it to be effortlessly composed as middleware with both Express and Connect applications.

You mount Limn in your application the same as you would other piece of middleware, by passing it to app.use().

Via Express:

var limn    = require('limn')
,   express = require('express')
;

var app = express.createServer()
  .use( express.logger('dev') )
  .use( express.static('public') )

app.get( '/', function(req, res){
  res.send('hello world');
})
  
  // Mount Limn at /vis
app.use( '/vis', limn({
    varDir  : './var',
    dataDir : './data',
    proxy   : true
  }) );

app.listen(3000);

Or via plain Connect:

var limn    = require('limn')
,   connect = require('connect')
;

var app = connect.createServer()
  .use( connect.logger('dev') )
  .use( connect.static('public') )
  
  // Mount Limn at /
  .use( limn({
    varDir  : './var',
    dataDir : './data',
    proxy   : true
  }) );

app.listen(3000);

Options

  • dataDir -- [$CWD/data] Path to directory where data files should be written.
  • proxy
    • enabled -- [false] Enables remote dataset proxy. If omitted, the proxy will be enabled if either proxy.whitelist or proxy.blacklist are set.
    • whitelist -- Array of domain patterns to whitelist for proxy. Strings are matched via glob-like syntax, but regular expressions may also be passed. If proxy.enabled is true but no whitelist is provided, it defaults to ['*'].
    • blacklist -- Array of domain patterns to blacklist from proxying. Strings are matched via glob-like syntax, but regular expressions may also be passed.
Clone this wiki locally