Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itty-router

Package Overview
Dependencies
Maintainers
1
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itty-router - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

package.json
{
"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'))

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc