0.0.1 • Published 7 years ago

app-configure v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

App Configure

View On:

npm install --save app-configure

A Simple App Configuration Handler

// Simple express example
var express = require('express');
var initial = require('./path/to/initial/handler');
var middleware = require('./path/to/middleware/handler');
var routes = require('./path/to/route/handler');
var app = express();

app.configure = require('app-configure');

app
  .configure(initial)
  .configure(middleware)
  .configure(routes)
  .listen(8000);

In General

Module: Configure

configure an app-context with a handler

Parameters

NameTypeDescription
handlerfunctionmethod should expect the app context
argsarrayoptional array of args to call with the handler
var app = {
  doThis: function (val) { ... },
  doThat: function (val) { ... },
  configure: require('app-configure')
};

var handler = function (thisValue, thatValue) {
  var app = this;

  app.doThis(thisValue);
  app.doThat(thatValue);
};

app.configure(handler, ['this', 'that']);