Skip to content

Commit d3e3d8d

Browse files
committed
readme
1 parent f51a36c commit d3e3d8d

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

README.md

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ JSON Routes
66
[![Coverage Status](https://coveralls.io/repos/github/gimox/json-routing/badge.svg?branch=2.0)](https://coveralls.io/github/gimox/json-routing?branch=2.0)
77

88

9-
### THIS IS A RC VERSION for v2.0 release
109

11-
Look at [v1.x](https://github.com/gimox/json-routing/tree/1.x) for more stable version.
10+
Look at branch [v1.x](https://github.com/gimox/json-routing/tree/1.x) for older release.
1211

1312
- Typescript code, more optimized
1413
- more speed
1514
- remove some unused option
1615
- make code more extensible and simple
16+
- add automatic JWT route protection with auth0/express-jwt
17+
- add route validator with express-validator
1718
- prepare it for something more......
1819

1920

@@ -701,8 +702,13 @@ All routes now start with `/api/vi`
701702
702703
Route validation params
703704
-----------------
704-
It can be done thanks to express-validator using schema. add `validators` object with: params, query or boby according
705-
to (express-validator)[https://github.com/ctavan/express-validator] "validation by Schema"
705+
It can be done by express-validator using schema. Add `validators` object with:
706+
707+
- params -> route params es /home/:id
708+
- query -> query params es -> /home?id=124
709+
- boby -> body params es post params like {"id":"1233"}
710+
711+
according [express-validator](https://github.com/ctavan/express-validator) "validation by Schema"
706712
707713
route file.json
708714
@@ -733,11 +739,44 @@ route file.json
733739
}
734740
}
735741
736-
NB body-parser middleware is injected by json-routing, you can pass params in global params
742+
```
743+
**NB body-parser middleware is injected by json-routing, you can pass params in global params**
744+
745+
746+
747+
ALL OPTIONS
748+
-----------------
749+
```javascript
750+
export interface IOptions {
751+
routesPath?: string
752+
, controllersPath?: string
753+
, policyPath?: string
754+
, processdir?: string
755+
, cors?: boolean
756+
, displayRoute?: boolean
757+
, defaultAction?: string
758+
, urlPrefix?: string
759+
, jwt?: {
760+
secret: any
761+
}
762+
, bodyParserUrlEncoded?: any
763+
}
764+
765+
...
766+
767+
let options: IOptions;
768+
769+
...
770+
// add params to optins object
771+
772+
773+
let routeInfo:Array<any> = new JsonRoute(app, options}).start();
737774
738775
```
739776
740777
778+
779+
741780
Example
742781
-----------------
743782
Look at ./demo for a fully working example.

0 commit comments

Comments
 (0)