rumkin / plant

🌳 JS web server charged with WebAPI and neat HTTP2 support
https://npmjs.com/package/@plant/plant
81 stars 6 forks source link

Add route capturing #6

Closed rumkin closed 5 years ago

rumkin commented 5 years ago
  1. [x] Add capture method.
  2. [x] Add captured slices.

Route#capture()

(part:string, params: object) -> Route

Add capture method to cut read part from the path, put it into captured slices and concat with the base. Also it receives a params object which stores name-value pairs extracted from the path.

route.capture(slice, params)

This method should return new route instance.

Route#captured

[{path: string, params: object}]

List of captured path-params pairs.