# express-conductor

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

Latest version **2.0.3** (published 2014-09-05) · mit license · 0 weekly downloads

## Install

```sh
npm install express-conductor
pnpm add express-conductor
yarn add express-conductor
bun add express-conductor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2014-09-05 |
| First published | 2012-10-27 |
| Weekly downloads | 0 |
| License | mit |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | taterbase |
| Maintainers | taterbase |
| Keywords | express, controllers |

## Links

- npm: https://www.npmjs.com/package/express-conductor
- Repository: https://github.com/taterbase/express-conductor
- Issues: https://github.com/taterbase/express-conductor/issues
- npm.io page: https://npm.io/package/express-conductor

## Dependencies (1)

- [waitress](https://npm.io/package/waitress.md) ~0.1.4

## Recent versions

- 2.0.3 (latest) — 2014-09-05
- 2.0.2 (awyeah) — 2014-03-26
- 2.0.1 — 2014-03-26
- 1.0.1 — 2013-08-19
- 1.0.0 — 2013-02-25
- 0.0.2 — 2013-01-08
- 0.0.1-4 — 2012-10-27
- 0.0.1-3 — 2012-10-27
- 0.0.1-2 — 2012-10-27
- 0.0.1-1 — 2012-10-27
- 0.0.1 — 2012-10-27

## README

<img src="express-conductor.png" alt="Express Conductor" />

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

##Status:
[![Build Status](https://travis-ci.org/taterbase/express-conductor.png)](https://travis-ci.org/taterbase/express-conductor)

##Usage:

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

```javascript
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.

```javascript
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

---
_Source: https://npm.io/package/express-conductor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
