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

koa2-router

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa2-router - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

6

lib/index.js

@@ -19,2 +19,3 @@ /*!

var mixin = require('utils-merge')
var compose = require('koa-compose')
var debug = require('debug')('koa2-router')

@@ -598,2 +599,7 @@ var deprecate = require('depd')('koa2-router')

if (callbacks.length > 1 && path !== '/' && path !== '*') {
// compose callbacks as one middleware
callbacks = [ compose(callbacks) ];
}
for (var i = 0; i < callbacks.length; i++) {

@@ -600,0 +606,0 @@ var fn = callbacks[i]

3

package.json
{
"name": "koa2-router",
"version": "1.1.1",
"version": "1.1.2",
"description": "A express-liked router component for koa2",

@@ -23,2 +23,3 @@ "main": "index.js",

"depd": "^2.0.0",
"koa-compose": "^4.1.0",
"methods": "^1.1.2",

@@ -25,0 +26,0 @@ "parseurl": "^1.3.2",

@@ -7,2 +7,9 @@ # koa2-router

## Features
* Express-style routing using .use|.params|.all|.route|[method]
* Arrayed path prefix
* Multiple, nestable router stacks
* 405 Method Not Allowed support
* 501 Not Implemented support
* Named router for debug
* Bounded baseUrl|url|params|matched|responded upon app.context|request|response

@@ -169,2 +176,22 @@ ## Getting Started

## API Documents
### Context
* ctx.baseUrl
* ctx.url
* ctx.params
* ctx.matched
* ctx.responded
### Router
* class Router(name: String | opts: Object):(ctx, next) => void
* router.use([path: String | String[]], ...middlewares: (ctx, next) => void):Router
* router.route(path: String | String[]):Route
* router.all([path: String | String[]], ...middlewares: (ctx, next) => void):Router
* router[method]([path: String | String[]], ...middlewares: (ctx, next) => void):Router
* router.params(name: String, callback: (ctx, next, value, name) => void):Router
### Route
* route.all([path: String | String[]], ...middlewares: (ctx, next) => void):Router
* route[method]([path: String | String[]], ...middlewares: (ctx, next) => void):Router
## Acknowledgements

@@ -171,0 +198,0 @@ * Thanks to the [expressjs/express][1] project

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