Notoriously Psychedelic Modules

    lime-static

    0.2.4 • Public • Published

    limerun lime-static

    Build Status NPM NPM NPM

    NPM

    About

    This is a simple static file router for OWIN-JS REST framework for the limerun project

    Installation

    $ npm install lime-static

    Usage

    var static = require('lime-static');
    app.use(static(filePath, options));

    Options

    • maxage Browser cache max-age in milliseconds. defaults to 0
    • hidden Allow transfer of hidden files. defaults to false
    • index Default file name, defaults to 'index.html'
    • defer If true, serves after yield next, allowing any downstream middleware to respond first
    • sync If true uses node fs synchronous calls, if false uses asynchronous

    Example

    // Dependencies
    const lime = require('limerun')
        , static = require('lime-static')
        , http = require('http');
     
    // Create Factories
    var app = new lime.app();
     
    // App
    app.use(static('.'));
    http.createServer(app.buildHttp()).listen(8000);

    Example with mount location

     
    // Dependencies
    const lime = require('limerun')
        , static = require('lime-static')
        , http = require('http');
     
    // Create Factories
    var app = new lime.app();
     
    // Mount app to map URL /bootstrap to file system directory \lib\vendor\bootstrap
    app.mount('/bootstrap', function(applet){
        applet.use(static('./lib/vendor/bootstrap', {sync:true}));
    });
     
    // Run app using standard owinJS host 
    http.createServer(app.buildHttp()).listen(8000);

    License

    Apache 2.0

    Install

    npm i lime-static

    DownloadsWeekly Downloads

    6

    Version

    0.2.4

    License

    none

    Last publish

    Collaborators

    • limerun