Skip to content

Commit

Permalink
Show how to use with plain node.js http server.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarruda committed Aug 29, 2012
1 parent 72598e4 commit b6401bb
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@ npm install flask-router

#### Usage

```js
var http = require('http')
, router = require('flask-router')()
, server = http.createServer(router.route);
```

It can also be used as a connect/express middleware:

```js
var connect = require('connect')
, app = connect()
, router = require('flask-router')();

app.use(router.route);

, router = require('flask-router')()
, app.use(router.route);
```

Then routes can be added like this:

```js
router.get('/users/<str(max=5,min=2):id>', function (req, res) {
console.log(req.params.id);
res.end();
Expand Down

0 comments on commit b6401bb

Please sign in to comment.