@eggjs/router 4.0.0-beta.20 → 4.0.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { MiddlewareFunc, MiddlewareFuncWithParamProperty, MiddlewareFuncWithRouter, Next, ParamMiddlewareFunc, ResourcesController } from "./types-DvonNcgV.js";
2
- import { Layer, LayerOptions, LayerURLOptions } from "./Layer-Br45DupW.js";
3
- import { AllowedMethodsOptions, MatchedResult, RegisterOptions, Router, RouterMethod, RouterOptions } from "./Router-BGI5feOg.js";
4
- import { EggRouter } from "./EggRouter-DcO6PAYI.js";
5
-
6
- //#region src/index.d.ts
7
- declare const KoaRouter: typeof Router;
8
- //#endregion
9
- export { AllowedMethodsOptions, EggRouter, KoaRouter, Layer, LayerOptions, LayerURLOptions, MatchedResult, MiddlewareFunc, MiddlewareFuncWithParamProperty, MiddlewareFuncWithRouter, Next, ParamMiddlewareFunc, RegisterOptions, ResourcesController, Router, RouterMethod, RouterOptions, Router as default };
1
+ import { Router } from './Router.ts';
2
+ export type * from './types.ts';
3
+ export * from './Layer.ts';
4
+ export * from './Router.ts';
5
+ export * from './EggRouter.ts';
6
+ export declare const KoaRouter: typeof Router;
7
+ export default Router;
package/dist/index.js CHANGED
@@ -1,11 +1,7 @@
1
- import { Layer } from "./Layer-CPiRgFSm.js";
2
- import "./types-CxAOQAAb.js";
3
- import { Router } from "./Router-CWrZ5wcC.js";
4
- import { EggRouter } from "./EggRouter-DvjBpJdR.js";
5
-
6
- //#region src/index.ts
7
- const KoaRouter = Router;
8
- var src_default = Router;
9
-
10
- //#endregion
11
- export { EggRouter, KoaRouter, Layer, Router, src_default as default };
1
+ import { Router } from "./Router.js";
2
+ export * from "./Layer.js";
3
+ export * from "./Router.js";
4
+ export * from "./EggRouter.js";
5
+ export const KoaRouter = Router;
6
+ export default Router;
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUdyQyxjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGdCQUFnQixDQUFDO0FBRS9CLE1BQU0sQ0FBQyxNQUFNLFNBQVMsR0FBRyxNQUFNLENBQUM7QUFDaEMsZUFBZSxNQUFNLENBQUMifQ==
package/dist/types.d.ts CHANGED
@@ -1,2 +1,18 @@
1
- import { MiddlewareFunc, MiddlewareFuncWithParamProperty, MiddlewareFuncWithRouter, Next, ParamMiddlewareFunc, ResourcesController } from "./types-DvonNcgV.js";
2
- export { MiddlewareFunc, MiddlewareFuncWithParamProperty, MiddlewareFuncWithRouter, Next, ParamMiddlewareFunc, ResourcesController };
1
+ export type Next = () => Promise<void>;
2
+ export type MiddlewareFunc = (ctx: any, next: Next) => Promise<void> | void;
3
+ export type MiddlewareFuncWithParamProperty = MiddlewareFunc & {
4
+ param?: string;
5
+ };
6
+ export type ParamMiddlewareFunc = (param: string, ctx: any, next: Next) => Promise<void> | void;
7
+ export type MiddlewareFuncWithRouter<T> = MiddlewareFunc & {
8
+ router: T;
9
+ };
10
+ export interface ResourcesController {
11
+ index?: MiddlewareFunc;
12
+ new?: MiddlewareFunc;
13
+ create?: MiddlewareFunc;
14
+ show?: MiddlewareFunc;
15
+ edit?: MiddlewareFunc;
16
+ update?: MiddlewareFunc;
17
+ destroy?: MiddlewareFunc;
18
+ }
package/dist/types.js CHANGED
@@ -1,3 +1,2 @@
1
- import "./types-CxAOQAAb.js";
2
-
3
- export { };
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/router",
3
- "version": "4.0.0-beta.20",
3
+ "version": "4.0.0-beta.21",
4
4
  "engines": {
5
5
  "node": ">=22.18.0"
6
6
  },
@@ -39,9 +39,9 @@
39
39
  "tsdown": "^0.15.4",
40
40
  "typescript": "^5.9.3",
41
41
  "vitest": "4.0.0-beta.16",
42
- "@eggjs/koa": "3.1.0-beta.20",
43
- "@eggjs/supertest": "9.0.0-beta.20",
44
- "@eggjs/tsconfig": "3.1.0-beta.20"
42
+ "@eggjs/koa": "3.1.0-beta.21",
43
+ "@eggjs/supertest": "9.0.0-beta.21",
44
+ "@eggjs/tsconfig": "3.1.0-beta.21"
45
45
  },
46
46
  "license": "MIT",
47
47
  "files": [
@@ -66,7 +66,7 @@
66
66
  "lint": "oxlint --type-aware",
67
67
  "typecheck": "tsc --noEmit",
68
68
  "test": "vitest run",
69
- "build": "tsdown",
69
+ "build": "tsdown && rimraf dist && tsc -b --clean && tsc",
70
70
  "prebench": "npm run build",
71
71
  "bench": "cd bench && make"
72
72
  }
@@ -1,108 +0,0 @@
1
- import { MiddlewareFunc, ResourcesController } from "./types-DvonNcgV.js";
2
- import { Layer } from "./Layer-Br45DupW.js";
3
- import { RegisterOptions, Router, RouterMethod, RouterOptions } from "./Router-BGI5feOg.js";
4
-
5
- //#region src/EggRouter.d.ts
6
- interface Application {
7
- controller: Record<string, any>;
8
- }
9
- /**
10
- * FIXME: move these patch into @eggjs/router
11
- */
12
- declare class EggRouter extends Router {
13
- readonly app: Application;
14
- /**
15
- * @class
16
- * @param {Object} opts - Router options.
17
- * @param {Application} app - Application object.
18
- */
19
- constructor(opts: RouterOptions, app: Application);
20
- verb(method: RouterMethod | RouterMethod[], nameOrPath: string | RegExp | (string | RegExp)[], pathOrMiddleware: string | RegExp | (string | RegExp)[] | MiddlewareFunc, ...middleware: (MiddlewareFunc | string)[]): this;
21
- head(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
22
- head(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
23
- options(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
24
- options(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
25
- get(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
26
- get(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
27
- put(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
28
- put(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
29
- patch(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
30
- patch(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
31
- post(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
32
- post(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
33
- delete(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
34
- delete(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
35
- all(path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
36
- all(name: string, path: string | RegExp | (string | RegExp)[], ...middlewares: (MiddlewareFunc | string)[]): Router;
37
- register(path: string | RegExp | (string | RegExp)[], methods: string[], middleware: MiddlewareFunc | string | (MiddlewareFunc | string | ResourcesController)[], opts?: RegisterOptions): Layer | Layer[];
38
- /**
39
- * restful router api
40
- * @param {String} name - Router name
41
- * @param {String} prefix - url prefix
42
- * @param {Function} middleware - middleware or controller
43
- * @example
44
- * ```js
45
- * app.resources('/posts', 'posts')
46
- * app.resources('posts', '/posts', 'posts')
47
- * app.resources('posts', '/posts', app.role.can('user'), app.controller.posts)
48
- * app.resources('posts', '/posts', middleware1, middleware2, app.controller.posts)
49
- * ```
50
- *
51
- * Examples:
52
- *
53
- * ```js
54
- * app.resources('/posts', 'posts')
55
- * ```
56
- *
57
- * yield router mapping
58
- *
59
- * Method | Path | Route Name | Controller.Action
60
- * -------|-----------------|----------------|-----------------------------
61
- * GET | /posts | posts | app.controller.posts.index
62
- * GET | /posts/new | new_post | app.controller.posts.new
63
- * GET | /posts/:id | post | app.controller.posts.show
64
- * GET | /posts/:id/edit | edit_post | app.controller.posts.edit
65
- * POST | /posts | posts | app.controller.posts.create
66
- * PATCH | /posts/:id | post | app.controller.posts.update
67
- * DELETE | /posts/:id | post | app.controller.posts.destroy
68
- *
69
- * app.router.url can generate url based on arguments
70
- * ```js
71
- * app.router.url('posts')
72
- * => /posts
73
- * app.router.url('post', { id: 1 })
74
- * => /posts/1
75
- * app.router.url('new_post')
76
- * => /posts/new
77
- * app.router.url('edit_post', { id: 1 })
78
- * => /posts/1/edit
79
- * ```
80
- * @return {Router} return route object.
81
- * @since 1.0.0
82
- */
83
- resources(prefix: string, controller: string | ResourcesController): Router;
84
- resources(prefix: string, middleware: MiddlewareFunc, controller: string | ResourcesController): Router;
85
- resources(name: string, prefix: string, controller: string | ResourcesController): Router;
86
- resources(name: string, prefix: string, middleware: MiddlewareFunc, controller: string | ResourcesController): Router;
87
- resources(nameOrPath: string | RegExp, ...middleware: (MiddlewareFunc | string | ResourcesController)[]): Router;
88
- /**
89
- * @param {String} name - Router name
90
- * @param {Object} params - more parameters
91
- * @example
92
- * ```js
93
- * router.url('edit_post', { id: 1, name: 'foo', page: 2 })
94
- * => /posts/1/edit?name=foo&page=2
95
- * router.url('posts', { name: 'foo&1', page: 2 })
96
- * => /posts?name=foo%261&page=2
97
- * ```
98
- * @return {String} url by path name and query params.
99
- * @since 1.0.0
100
- */
101
- url(name: string, params?: Record<string, string | number | (string | number)[]>): string;
102
- /**
103
- * @alias to url()
104
- */
105
- pathFor(name: string, params?: Record<string, string | number | (string | number)[]>): string;
106
- }
107
- //#endregion
108
- export { EggRouter };
@@ -1,208 +0,0 @@
1
- import { Router } from "./Router-CWrZ5wcC.js";
2
- import assert from "node:assert";
3
- import { encodeURIComponent } from "utility";
4
- import inflection from "inflection";
5
- import methods from "methods";
6
- import { isGeneratorFunction } from "is-type-of";
7
-
8
- //#region src/EggRouter.ts
9
- const REST_MAP = {
10
- index: {
11
- suffix: "",
12
- method: "GET"
13
- },
14
- new: {
15
- namePrefix: "new_",
16
- member: true,
17
- suffix: "new",
18
- method: "GET"
19
- },
20
- create: {
21
- suffix: "",
22
- method: "POST"
23
- },
24
- show: {
25
- member: true,
26
- suffix: ":id",
27
- method: "GET"
28
- },
29
- edit: {
30
- member: true,
31
- namePrefix: "edit_",
32
- suffix: ":id/edit",
33
- method: "GET"
34
- },
35
- update: {
36
- member: true,
37
- namePrefix: "",
38
- suffix: ":id",
39
- method: ["PATCH", "PUT"]
40
- },
41
- destroy: {
42
- member: true,
43
- namePrefix: "destroy_",
44
- suffix: ":id",
45
- method: "DELETE"
46
- }
47
- };
48
- /**
49
- * FIXME: move these patch into @eggjs/router
50
- */
51
- var EggRouter = class extends Router {
52
- app;
53
- /**
54
- * @class
55
- * @param {Object} opts - Router options.
56
- * @param {Application} app - Application object.
57
- */
58
- constructor(opts, app) {
59
- super(opts);
60
- this.app = app;
61
- }
62
- verb(method, nameOrPath, pathOrMiddleware, ...middleware) {
63
- const { path, middlewares, options } = this._formatRouteParams(nameOrPath, pathOrMiddleware, middleware);
64
- if (typeof method === "string") method = [method];
65
- this.register(path, method, middlewares, options);
66
- return this;
67
- }
68
- head(nameOrPath, pathOrMiddleware, ...middlewares) {
69
- return this.verb("head", nameOrPath, pathOrMiddleware, ...middlewares);
70
- }
71
- options(nameOrPath, pathOrMiddleware, ...middlewares) {
72
- return this.verb("options", nameOrPath, pathOrMiddleware, ...middlewares);
73
- }
74
- get(nameOrPath, pathOrMiddleware, ...middlewares) {
75
- return this.verb("get", nameOrPath, pathOrMiddleware, ...middlewares);
76
- }
77
- put(nameOrPath, pathOrMiddleware, ...middlewares) {
78
- return this.verb("put", nameOrPath, pathOrMiddleware, ...middlewares);
79
- }
80
- patch(nameOrPath, pathOrMiddleware, ...middlewares) {
81
- return this.verb("patch", nameOrPath, pathOrMiddleware, ...middlewares);
82
- }
83
- post(nameOrPath, pathOrMiddleware, ...middlewares) {
84
- return this.verb("post", nameOrPath, pathOrMiddleware, ...middlewares);
85
- }
86
- delete(nameOrPath, pathOrMiddleware, ...middlewares) {
87
- return this.verb("delete", nameOrPath, pathOrMiddleware, ...middlewares);
88
- }
89
- all(nameOrPath, pathOrMiddleware, ...middlewares) {
90
- return this.verb(methods, nameOrPath, pathOrMiddleware, ...middlewares);
91
- }
92
- register(path, methods$1, middleware, opts) {
93
- middleware = Array.isArray(middleware) ? middleware : [middleware];
94
- for (const mw of middleware) if (isGeneratorFunction(mw)) throw new TypeError(methods$1.toString() + " `" + path + "`: Please use async function instead of generator function");
95
- const middlewares = convertMiddlewares(middleware, this.app);
96
- return super.register(path, methods$1, middlewares, opts);
97
- }
98
- resources(nameOrPath, pathOrMiddleware, ...middleware) {
99
- const { path, middlewares, options } = this._formatRouteParams(nameOrPath, pathOrMiddleware, middleware);
100
- const controller = resolveController(middlewares.pop(), this.app);
101
- for (const key in REST_MAP) {
102
- const action = controller[key];
103
- if (!action) continue;
104
- const opts = REST_MAP[key];
105
- let routeName;
106
- if (opts.member) routeName = inflection.singularize(options.name ?? "");
107
- else routeName = inflection.pluralize(options.name ?? "");
108
- if (opts.namePrefix) routeName = opts.namePrefix + routeName;
109
- const prefix = path.replace(/\/$/, "");
110
- const urlPath = opts.suffix ? `${prefix}/${opts.suffix}` : prefix;
111
- const method = Array.isArray(opts.method) ? opts.method : [opts.method];
112
- this.register(urlPath, method, middlewares.concat(action), { name: routeName });
113
- }
114
- return this;
115
- }
116
- /**
117
- * @param {String} name - Router name
118
- * @param {Object} params - more parameters
119
- * @example
120
- * ```js
121
- * router.url('edit_post', { id: 1, name: 'foo', page: 2 })
122
- * => /posts/1/edit?name=foo&page=2
123
- * router.url('posts', { name: 'foo&1', page: 2 })
124
- * => /posts?name=foo%261&page=2
125
- * ```
126
- * @return {String} url by path name and query params.
127
- * @since 1.0.0
128
- */
129
- url(name, params) {
130
- const route = this.route(name);
131
- if (!route) return "";
132
- const args = params;
133
- let url = route.path;
134
- assert(!(url instanceof RegExp), `Can't get the url for regExp ${url} for by name '${name}'`);
135
- const queries = [];
136
- if (typeof args === "object" && args !== null) {
137
- const replacedParams = [];
138
- url = url.replace(/:([a-zA-Z_]\w*)/g, ($0, key) => {
139
- if (key in args) {
140
- const values = args[key];
141
- replacedParams.push(key);
142
- return encodeURIComponent(Array.isArray(values) ? String(values[0]) : String(values));
143
- }
144
- return $0;
145
- });
146
- for (const key in args) {
147
- if (replacedParams.includes(key)) continue;
148
- const values = args[key];
149
- const encodedKey = encodeURIComponent(key);
150
- if (Array.isArray(values)) for (const val of values) queries.push(`${encodedKey}=${encodeURIComponent(String(val))}`);
151
- else queries.push(`${encodedKey}=${encodeURIComponent(String(values))}`);
152
- }
153
- }
154
- if (queries.length > 0) {
155
- const queryStr = queries.join("&");
156
- if (!url.includes("?")) url = `${url}?${queryStr}`;
157
- else url = `${url}&${queryStr}`;
158
- }
159
- return url;
160
- }
161
- /**
162
- * @alias to url()
163
- */
164
- pathFor(name, params) {
165
- return this.url(name, params);
166
- }
167
- };
168
- /**
169
- * resolve controller from string to function
170
- * @param {String|Function} controller input controller
171
- * @param {Application} app egg application instance
172
- */
173
- function resolveController(controller, app) {
174
- if (typeof controller === "string") {
175
- const actions = controller.split(".");
176
- let obj = app.controller;
177
- actions.forEach((key) => {
178
- obj = obj[key];
179
- if (!obj) throw new Error(`app.controller.${controller} not exists`);
180
- });
181
- controller = obj;
182
- }
183
- if (!controller) throw new Error("controller not exists");
184
- return controller;
185
- }
186
- /**
187
- * 1. ensure controller(last argument) support string
188
- * - [url, controller]: app.get('/home', 'home');
189
- * - [name, url, controller(string)]: app.get('posts', '/posts', 'posts.list');
190
- * - [name, url, controller]: app.get('posts', '/posts', app.controller.posts.list);
191
- * - [name, url(regexp), controller]: app.get('regRouter', /\/home\/index/, 'home.index');
192
- * - [name, url, middleware, [...], controller]: `app.get(/user/:id', hasLogin, canGetUser, 'user.show');`
193
- *
194
- * 2. bind ctx to controller `this`
195
- *
196
- * @param {Array} middlewares middlewares and controller(last middleware)
197
- * @param {Application} app egg application instance
198
- */
199
- function convertMiddlewares(middlewares, app) {
200
- const controller = resolveController(middlewares.pop(), app);
201
- function wrappedController(ctx, next) {
202
- return controller.apply(ctx, [ctx, next]);
203
- }
204
- return [...middlewares, wrappedController];
205
- }
206
-
207
- //#endregion
208
- export { EggRouter };
@@ -1,118 +0,0 @@
1
- import { MiddlewareFunc, MiddlewareFuncWithParamProperty, ParamMiddlewareFunc } from "./types-DvonNcgV.js";
2
- import { Key } from "path-to-regexp";
3
-
4
- //#region src/Layer.d.ts
5
- interface LayerOptions {
6
- prefix?: string;
7
- /** route name */
8
- name?: string;
9
- /** case sensitive (default: false) */
10
- sensitive?: boolean;
11
- /** require the trailing slash (default: false) */
12
- strict?: boolean;
13
- ignoreCaptures?: boolean;
14
- end?: boolean;
15
- }
16
- interface LayerURLOptions {
17
- query?: string | object;
18
- }
19
- declare class Layer {
20
- readonly opts: LayerOptions;
21
- readonly name?: string;
22
- readonly methods: string[];
23
- readonly stack: MiddlewareFuncWithParamProperty[];
24
- path: string | RegExp;
25
- regexp: RegExp;
26
- paramNames: Key[];
27
- /**
28
- * Initialize a new routing Layer with given `method`, `path`, and `middleware`.
29
- *
30
- * @param {String|RegExp} path Path string or regular expression.
31
- * @param {Array} methods Array of HTTP verbs.
32
- * @param {Array|Function} middlewares Layer callback/middleware or series of.
33
- * @param {Object=} opts optional params
34
- * @param {String=} opts.name route name
35
- * @param {String=} opts.sensitive case sensitive (default: false)
36
- * @param {String=} opts.strict require the trailing slash (default: false)
37
- * @private
38
- */
39
- constructor(path: string | RegExp, methods: string[], middlewares: MiddlewareFunc | MiddlewareFunc[], opts?: LayerOptions | string);
40
- /**
41
- * Returns whether request `path` matches route.
42
- *
43
- * @param {String} path path string
44
- * @return {Boolean} matched or not
45
- * @private
46
- */
47
- match(path: string): boolean;
48
- /**
49
- * Returns map of URL parameters for given `path` and `paramNames`.
50
- *
51
- * @param {String} _path path string
52
- * @param {Array.<String>} captures captures strings
53
- * @param {Object=} [existingParams] existing params
54
- * @return {Object} params object
55
- * @private
56
- */
57
- params(_path: string, captures: Array<string>, existingParams?: Record<string, string>): Record<string, string>;
58
- /**
59
- * Returns array of regexp url path captures.
60
- *
61
- * @param {String} path path string
62
- * @return {Array.<String>} captures strings
63
- * @private
64
- */
65
- captures(path: string): Array<string>;
66
- /**
67
- * Generate URL for route using given `params`.
68
- *
69
- * @example
70
- *
71
- * ```javascript
72
- * var route = new Layer(['GET'], '/users/:id', fn);
73
- *
74
- * route.url(123); // => "/users/123"
75
- * route.url('123'); // => "/users/123"
76
- * route.url({ id: 123 }); // => "/users/123"
77
- * ```
78
- *
79
- * @param {Object} params url parameters
80
- * @param {Object} paramsOrOptions optional parameters
81
- * @return {String} url string
82
- * @private
83
- */
84
- url(params?: string | number | object, ...paramsOrOptions: (string | number | object | LayerURLOptions)[]): string;
85
- /**
86
- * Run validations on route named parameters.
87
- *
88
- * @example
89
- *
90
- * ```javascript
91
- * router
92
- * .param('user', function (id, ctx, next) {
93
- * ctx.user = users[id];
94
- * if (!user) return ctx.status = 404;
95
- * next();
96
- * })
97
- * .get('/users/:user', function (ctx, next) {
98
- * ctx.body = ctx.user;
99
- * });
100
- * ```
101
- *
102
- * @param {String} param param string
103
- * @param {Function} fn middleware function
104
- * @return {Layer} layer instance
105
- * @private
106
- */
107
- param(param: string, fn: ParamMiddlewareFunc): Layer;
108
- /**
109
- * Prefix route path.
110
- *
111
- * @param {String} prefix prefix string
112
- * @return {Layer} layer instance
113
- * @private
114
- */
115
- setPrefix(prefix: string): Layer;
116
- }
117
- //#endregion
118
- export { Layer, LayerOptions, LayerURLOptions };