Skip to content

magically binds controllers to your express app based on a file path to your controllers

License

Notifications You must be signed in to change notification settings

danjamin/express-bind-controllers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-bind-controllers

Magically binds controllers to your express app based on a file path to your controllers, and an optional file name filter function

Installation

npm install -S express-bind-controllers

Example usage

// index.js

var express = require('express');
var app = express();
var bindControllers = require('express-bind-controllers');
var isVerbose = true;
var filter;

// ...

// filters so that only files that end in .js are used as controllers
// this is the default behavior
filter = function (name) {
  return /.js$/.test(name);
};

// Bind controllers
bindControllers(app, __dirname + '/app/controllers', isVerbose, filter);

About

magically binds controllers to your express app based on a file path to your controllers

Resources

License

Stars

Watchers

Forks

Packages

No packages published