JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9430
  • Score
    100M100P100Q129124F
  • License MIT

TypeScript definitions for koa-route

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/koa-route) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/koa-route

    Summary

    This package contains type definitions for koa-route (https://github.com/koajs/route#readme).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-route.

    index.d.ts

    import Koa = require("koa");
    import pathToRegexp = require("path-to-regexp");
    
    declare namespace KoaRoute {
        type Path = string | RegExp | Array<string | RegExp>;
    
        /**
         * The Koa handler will receive parameters extracted from the route as extra arguments.
         */
        type Handler = (this: Koa.Context, ctx: Koa.Context, ...params: any[]) => any;
    
        type CreateRoute = (routeFunc: Handler) => Koa.Middleware;
    
        interface Method {
            (path: Path): CreateRoute;
            (path: Path, fn: Handler, opts?: pathToRegexp.ParseOptions & pathToRegexp.RegExpOptions): Koa.Middleware;
        }
    
        type CreateMethod = (method: string) => Method;
    
        interface Routes {
            all: Method;
            acl: Method;
            bind: Method;
            checkout: Method;
            connect: Method;
            copy: Method;
            delete: Method;
            del: Method;
            get: Method;
            head: Method;
            link: Method;
            lock: Method;
            msearch: Method;
            merge: Method;
            mkactivity: Method;
            mkcalendar: Method;
            mkcol: Method;
            move: Method;
            notify: Method;
            options: Method;
            patch: Method;
            post: Method;
            propfind: Method;
            proppatch: Method;
            purge: Method;
            put: Method;
            rebind: Method;
            report: Method;
            search: Method;
            subscribe: Method;
            trace: Method;
            unbind: Method;
            unlink: Method;
            unlock: Method;
            unsubscribe: Method;
        }
    }
    
    declare const routes: KoaRoute.Routes;
    
    export = routes;
    

    Additional Details

    Credits

    These definitions were written by Mike Cook, and Jaco Greeff.