Skip to content

Commit

Permalink
Updated to 0.9.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
bow-fujita committed Feb 25, 2016
1 parent 6870cbd commit 8697c8a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ var express = require('express')
, app = express()
;

exprest.route(app, { url: '/api' });

app.listen();
exprest.route(app, { url: '/api' })
.then(function() {
app.listen();
});
```

`exprest4` regards each file/directory under the `controllers` directory as a controller module in terms of MVC, and routes everything upon `route()` call.
Expand Down Expand Up @@ -98,7 +99,7 @@ app.delete('/api/example/:id', example.remove);

## Methods

### `route(app[, opts])`
### `route(app[, opts]) -> Promise`

`exprest` routes controller modules for `app` which must be an Express instance.

Expand Down Expand Up @@ -134,11 +135,16 @@ var path = require('path')
, controllers_dir = path.join(process.cwd(), 'controllers')
;

api_versions.forEach(function(version) {
exprest.route(app, {
url: '/api/v'+version
, controllers: path.join(controllers_dir, 'v'+version)
});
Promise.all(
api_versions.map(function(version) {
return exprest.route(app, {
url: '/api/v'+version
, controllers: path.join(controllers_dir, 'v'+version)
});
})
)
.then(function() {
app.listen();
});
```

Expand All @@ -159,6 +165,9 @@ var path = require('path')
exprest.route(app, {
url: '/api'
, authorizer: ensureLoggedIn('/login')
})
.then(function() {
app.listen();
});
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exprest4",
"version": "0.9.4",
"version": "0.9.5",
"description": "REST API framework for Express 4.x.",
"homepage": "https://github.com/bow-fujita/exprest4",
"repository": {
Expand Down

0 comments on commit 8697c8a

Please sign in to comment.