itty-router
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "itty-router", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Tiny, zero-dependency router with route param and query parsing.", | ||
@@ -5,0 +5,0 @@ "main": "dist/itty-router.min.js", |
@@ -43,10 +43,7 @@ ![image](https://user-images.githubusercontent.com/865416/79531114-fa0d8200-8036-11ea-824d-70d84164b00a.png) | ||
// basic GET route | ||
router.get('/todos/:id', console.log) | ||
// basic GET route (with optional ? flag)... delivers route params and query params as objects to handler | ||
router.get('/todos/:id?', ({ params, query }) => | ||
console.log('will match both /todos and /todos/13', `id=${params.id}`, `limit=${query.limit}`) | ||
) | ||
// first match always wins, so be careful with order of registering routes | ||
router.get('/todos/oops', () => console.log('you will never see this, thanks to upstream /todos/:id')) | ||
router.get('/features/chainable-route-declaration', () => console.log('yep!')) | ||
router.get('/features/:optionals?', () => console.log('check!')) // will match /features and /features/14 both | ||
// works with POST, DELETE, PATCH, etc | ||
@@ -53,0 +50,0 @@ router.post('/todos', () => console.log('posted a todo')) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13357
228