Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show how to use with plain node.js http server.

  • Loading branch information...
commit b6401bb62287b3e77023ac171f4df031262d4637 1 parent 72598e4
@tarruda authored
Showing with 15 additions and 4 deletions.
  1. +15 −4 README.mkd
View
19 README.mkd
@@ -11,12 +11,23 @@ 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();
Please sign in to comment.
Something went wrong with that request. Please try again.