Napoleon's Penguin Mascot

    cgi-gin

    0.0.2 • Public • Published

    cgi-gin

    Connect middleware for a folder of javascript modules

    usage

    Mount a whole folder of javascript modules onto '/scripts':

    var gin = require('../index');
    var express = require('express');
    var http = require('http');
     
    var app = express();
    var server = http.createServer(app);
     
    app.use('/scripts', gin('/my/folder/of/js/files', {
        my:'options'
    }))

    A single module (test1.js) in the folder:

    module.exports = function(options){
     
        // options are the same for each module
     
        return function(req, res, next){
            // module code here
        }
    }

    This script will be run on these urls:

    • /scripts/test1
    • /scripts/test1.js

    installation

    $ npm install cgi-gin
    

    methods

    gin(folder, options)

    return a connect middleware that loads all .js files in folder and passes options to the module expecting a middleware function back.

    options are the same for each module

    license

    MIT

    Keywords

    none

    Install

    npm i cgi-gin

    DownloadsWeekly Downloads

    10

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • binocarlos