2.0.3 • Published 10 years ago

express-conductor v2.0.3

Weekly downloads
1
License
mit
Repository
github
Last release
10 years ago

A library for moving your express routes/controllers out of your app file.

##Status: Build Status

##Usage:

Require express-conductor and after configuring your app file, pass it in detailing the location of your routes and controllers.

var expressConductor = require('express-conductor');

/*
 * Normal express setup...
 */

expressConductor.init(app, {controllers: __dirname + '/controllers'}, function(err, app){
  http.createServer(app).listen(PORT, function(){
    console.log("Express server listening on port " + PORT);
  });
});

Inside your routes/controllers folder you can structure your files however you want. Express-conductor will traverse folders and grab any file. You can have a simple file layout

controllers
├── index.js
└── posts.js

Or you can have a nested structure to imitate actions

controllers
├── Posts
|   ├── show.js
|   ├── create.js
|   └── etc...
└── Comments
    ├── show.js
    ├── create.js
    └── etc...

Express-conductor will grab them all. Just expose an init function and define your routes accordingly.

module.exports.init = function(app){
  app.get('/posts/:id', showPost);
};

function showPost(req, res){
  //Show post
}

##Testing Be sure to install the dev dependencies and just run npm test

##License MIT

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.0.2

11 years ago

0.0.1-4

12 years ago

0.0.1-3

12 years ago

0.0.1-2

12 years ago

0.0.1-1

12 years ago

0.0.1

12 years ago