@adonisjs/http-server 6.8.2-9 → 7.0.0-0
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/build/chunk-XX72ATFY.js +4388 -0
- package/build/factories/main.d.ts +149 -6
- package/build/factories/main.js +331 -14
- package/build/index.d.ts +272 -14
- package/build/index.js +308 -22
- package/build/{src/server/main.d.ts → main-29eaaee4.d.ts} +12 -17
- package/build/main-e5b46c83.d.ts +2210 -0
- package/build/src/types/main.d.ts +14 -7
- package/build/src/types/main.js +0 -15
- package/package.json +62 -53
- package/build/factories/http_context.d.ts +0 -25
- package/build/factories/http_context.js +0 -51
- package/build/factories/http_server.d.ts +0 -8
- package/build/factories/http_server.js +0 -26
- package/build/factories/qs_parser_factory.d.ts +0 -20
- package/build/factories/qs_parser_factory.js +0 -44
- package/build/factories/request.d.ts +0 -29
- package/build/factories/request.js +0 -73
- package/build/factories/response.d.ts +0 -29
- package/build/factories/response.js +0 -77
- package/build/factories/router.d.ts +0 -23
- package/build/factories/router.js +0 -45
- package/build/factories/server_factory.d.ts +0 -29
- package/build/factories/server_factory.js +0 -65
- package/build/src/cookies/client.d.ts +0 -37
- package/build/src/cookies/client.js +0 -84
- package/build/src/cookies/drivers/encrypted.d.ts +0 -16
- package/build/src/cookies/drivers/encrypted.js +0 -36
- package/build/src/cookies/drivers/plain.d.ts +0 -15
- package/build/src/cookies/drivers/plain.js +0 -33
- package/build/src/cookies/drivers/signed.d.ts +0 -16
- package/build/src/cookies/drivers/signed.js +0 -36
- package/build/src/cookies/parser.d.ts +0 -37
- package/build/src/cookies/parser.js +0 -167
- package/build/src/cookies/serializer.d.ts +0 -33
- package/build/src/cookies/serializer.js +0 -79
- package/build/src/debug.d.ts +0 -3
- package/build/src/debug.js +0 -10
- package/build/src/define_config.d.ts +0 -5
- package/build/src/define_config.js +0 -51
- package/build/src/define_middleware.d.ts +0 -11
- package/build/src/define_middleware.js +0 -35
- package/build/src/exception_handler.d.ts +0 -112
- package/build/src/exception_handler.js +0 -303
- package/build/src/exceptions.d.ts +0 -84
- package/build/src/exceptions.js +0 -38
- package/build/src/helpers.d.ts +0 -23
- package/build/src/helpers.js +0 -84
- package/build/src/http_context/local_storage.d.ts +0 -12
- package/build/src/http_context/local_storage.js +0 -39
- package/build/src/http_context/main.d.ts +0 -58
- package/build/src/http_context/main.js +0 -105
- package/build/src/qs.d.ts +0 -11
- package/build/src/qs.js +0 -25
- package/build/src/redirect.d.ts +0 -42
- package/build/src/redirect.js +0 -140
- package/build/src/request.d.ts +0 -565
- package/build/src/request.js +0 -865
- package/build/src/response.d.ts +0 -540
- package/build/src/response.js +0 -1208
- package/build/src/router/brisk.d.ts +0 -42
- package/build/src/router/brisk.js +0 -85
- package/build/src/router/executor.d.ts +0 -8
- package/build/src/router/executor.js +0 -29
- package/build/src/router/factories/use_return_value.d.ts +0 -6
- package/build/src/router/factories/use_return_value.js +0 -22
- package/build/src/router/group.d.ts +0 -65
- package/build/src/router/group.js +0 -207
- package/build/src/router/lookup_store/main.d.ts +0 -49
- package/build/src/router/lookup_store/main.js +0 -86
- package/build/src/router/lookup_store/route_finder.d.ts +0 -21
- package/build/src/router/lookup_store/route_finder.js +0 -49
- package/build/src/router/lookup_store/url_builder.d.ts +0 -52
- package/build/src/router/lookup_store/url_builder.js +0 -209
- package/build/src/router/main.d.ts +0 -128
- package/build/src/router/main.js +0 -316
- package/build/src/router/matchers.d.ts +0 -27
- package/build/src/router/matchers.js +0 -36
- package/build/src/router/parser.d.ts +0 -5
- package/build/src/router/parser.js +0 -17
- package/build/src/router/resource.d.ts +0 -54
- package/build/src/router/resource.js +0 -216
- package/build/src/router/route.d.ts +0 -92
- package/build/src/router/route.js +0 -293
- package/build/src/router/store.d.ts +0 -66
- package/build/src/router/store.js +0 -195
- package/build/src/server/factories/final_handler.d.ts +0 -9
- package/build/src/server/factories/final_handler.js +0 -30
- package/build/src/server/factories/middleware_handler.d.ts +0 -8
- package/build/src/server/factories/middleware_handler.js +0 -16
- package/build/src/server/factories/write_response.d.ts +0 -6
- package/build/src/server/factories/write_response.js +0 -24
- package/build/src/server/main.js +0 -283
- package/build/src/types/base.d.ts +0 -19
- package/build/src/types/base.js +0 -9
- package/build/src/types/middleware.d.ts +0 -35
- package/build/src/types/middleware.js +0 -9
- package/build/src/types/qs.d.ts +0 -68
- package/build/src/types/qs.js +0 -9
- package/build/src/types/request.d.ts +0 -39
- package/build/src/types/request.js +0 -9
- package/build/src/types/response.d.ts +0 -45
- package/build/src/types/response.js +0 -9
- package/build/src/types/route.d.ts +0 -165
- package/build/src/types/route.js +0 -9
- package/build/src/types/server.d.ts +0 -72
- package/build/src/types/server.js +0 -9
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Macroable from '@poppinss/macroable';
|
|
2
|
-
/**
|
|
3
|
-
* Shortcut methods for commonly used route matchers
|
|
4
|
-
*/
|
|
5
|
-
export declare class RouteMatchers extends Macroable {
|
|
6
|
-
/**
|
|
7
|
-
* Enforce value to be a number and also casts it to number data
|
|
8
|
-
* type
|
|
9
|
-
*/
|
|
10
|
-
number(): {
|
|
11
|
-
match: RegExp;
|
|
12
|
-
cast: (value: string) => number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Enforce value to be formatted as uuid
|
|
16
|
-
*/
|
|
17
|
-
uuid(): {
|
|
18
|
-
match: RegExp;
|
|
19
|
-
cast: (value: string) => string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Enforce value to be formatted as slug
|
|
23
|
-
*/
|
|
24
|
-
slug(): {
|
|
25
|
-
match: RegExp;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import Macroable from '@poppinss/macroable';
|
|
10
|
-
/**
|
|
11
|
-
* Shortcut methods for commonly used route matchers
|
|
12
|
-
*/
|
|
13
|
-
export class RouteMatchers extends Macroable {
|
|
14
|
-
/**
|
|
15
|
-
* Enforce value to be a number and also casts it to number data
|
|
16
|
-
* type
|
|
17
|
-
*/
|
|
18
|
-
number() {
|
|
19
|
-
return { match: /^[0-9]+$/, cast: (value) => Number(value) };
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Enforce value to be formatted as uuid
|
|
23
|
-
*/
|
|
24
|
-
uuid() {
|
|
25
|
-
return {
|
|
26
|
-
match: /^[0-9a-zA-F]{8}-[0-9a-zA-F]{4}-[0-9a-zA-F]{4}-[0-9a-zA-F]{4}-[0-9a-zA-F]{12}$/,
|
|
27
|
-
cast: (value) => value.toLowerCase(),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Enforce value to be formatted as slug
|
|
32
|
-
*/
|
|
33
|
-
slug() {
|
|
34
|
-
return { match: /^[^\s-_](?!.*?[-_]{2,})([a-z0-9-\\]{1,})[^\s]*[^-_\s]$/ };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
// @ts-expect-error
|
|
10
|
-
import matchit from '@poppinss/matchit';
|
|
11
|
-
/**
|
|
12
|
-
* Parses the route pattern
|
|
13
|
-
*/
|
|
14
|
-
export function parseRoutePattern(pattern, matchers) {
|
|
15
|
-
const tokens = matchit.parse(pattern, matchers);
|
|
16
|
-
return tokens;
|
|
17
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import Macroable from '@poppinss/macroable';
|
|
2
|
-
import type { Application } from '@adonisjs/application';
|
|
3
|
-
import { Route } from './route.js';
|
|
4
|
-
import type { Constructor, LazyImport } from '../types/base.js';
|
|
5
|
-
import type { ParsedGlobalMiddleware } from '../types/middleware.js';
|
|
6
|
-
import type { ResourceActionNames, RouteMatcher, RouteMatchers } from '../types/route.js';
|
|
7
|
-
/**
|
|
8
|
-
* Route resource exposes the API to register multiple routes for a resource.
|
|
9
|
-
*/
|
|
10
|
-
export declare class RouteResource extends Macroable {
|
|
11
|
-
#private;
|
|
12
|
-
/**
|
|
13
|
-
* A collection of routes instances that belongs to this resource
|
|
14
|
-
*/
|
|
15
|
-
routes: Route[];
|
|
16
|
-
constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
|
|
17
|
-
resource: string;
|
|
18
|
-
controller: string | LazyImport<Constructor<any>> | Constructor<any>;
|
|
19
|
-
globalMatchers: RouteMatchers;
|
|
20
|
-
shallow: boolean;
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Register only given routes and remove others
|
|
24
|
-
*/
|
|
25
|
-
only(names: ResourceActionNames[]): this;
|
|
26
|
-
/**
|
|
27
|
-
* Register all routes, except the one's defined
|
|
28
|
-
*/
|
|
29
|
-
except(names: ResourceActionNames[]): this;
|
|
30
|
-
/**
|
|
31
|
-
* Register api only routes. The `create` and `edit` routes, which
|
|
32
|
-
* are meant to show forms will not be registered
|
|
33
|
-
*/
|
|
34
|
-
apiOnly(): this;
|
|
35
|
-
/**
|
|
36
|
-
* Define matcher for params inside the resource
|
|
37
|
-
*/
|
|
38
|
-
where(key: string, matcher: RouteMatcher | string | RegExp): this;
|
|
39
|
-
/**
|
|
40
|
-
* Tap into multiple routes to configure them by their name
|
|
41
|
-
*/
|
|
42
|
-
tap(callback: (route: Route) => void): this;
|
|
43
|
-
tap(actions: ResourceActionNames | ResourceActionNames[], callback: (route: Route) => void): this;
|
|
44
|
-
/**
|
|
45
|
-
* Set the param name for a given resource
|
|
46
|
-
*/
|
|
47
|
-
params(resources: {
|
|
48
|
-
[resource: string]: string;
|
|
49
|
-
}): this;
|
|
50
|
-
/**
|
|
51
|
-
* Prepend name to all the routes
|
|
52
|
-
*/
|
|
53
|
-
as(name: string, normalizeName?: boolean): this;
|
|
54
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import string from '@poppinss/utils/string';
|
|
10
|
-
import Macroable from '@poppinss/macroable';
|
|
11
|
-
import { RuntimeException } from '@poppinss/utils';
|
|
12
|
-
import { Route } from './route.js';
|
|
13
|
-
/**
|
|
14
|
-
* Route resource exposes the API to register multiple routes for a resource.
|
|
15
|
-
*/
|
|
16
|
-
export class RouteResource extends Macroable {
|
|
17
|
-
/**
|
|
18
|
-
* Resource identifier. Nested resources are separated
|
|
19
|
-
* with a dot notation
|
|
20
|
-
*/
|
|
21
|
-
#resource;
|
|
22
|
-
/**
|
|
23
|
-
* The controller to handle resource routing requests
|
|
24
|
-
*/
|
|
25
|
-
#controller;
|
|
26
|
-
/**
|
|
27
|
-
* Is it a shallow resource? Shallow resources URLs do not have parent
|
|
28
|
-
* resource name and id once they can be identified with the id.
|
|
29
|
-
*/
|
|
30
|
-
#shallow = false;
|
|
31
|
-
/**
|
|
32
|
-
* Matchers inherited from the router
|
|
33
|
-
*/
|
|
34
|
-
#globalMatchers;
|
|
35
|
-
/**
|
|
36
|
-
* Reference to the AdonisJS application
|
|
37
|
-
*/
|
|
38
|
-
#app;
|
|
39
|
-
/**
|
|
40
|
-
* Middleware registered on the router
|
|
41
|
-
*/
|
|
42
|
-
#routerMiddleware;
|
|
43
|
-
/**
|
|
44
|
-
* Parameter names for the resources. Defaults to `id` for
|
|
45
|
-
* a singular resource and `resource_id` for nested
|
|
46
|
-
* resources.
|
|
47
|
-
*/
|
|
48
|
-
#params = {};
|
|
49
|
-
/**
|
|
50
|
-
* Base name for the routes. We suffix action names
|
|
51
|
-
* on top of the base name
|
|
52
|
-
*/
|
|
53
|
-
#routesBaseName;
|
|
54
|
-
/**
|
|
55
|
-
* A collection of routes instances that belongs to this resource
|
|
56
|
-
*/
|
|
57
|
-
routes = [];
|
|
58
|
-
constructor(app, routerMiddleware, options) {
|
|
59
|
-
super();
|
|
60
|
-
this.#validateResourceName(options.resource);
|
|
61
|
-
this.#app = app;
|
|
62
|
-
this.#shallow = options.shallow;
|
|
63
|
-
this.#routerMiddleware = routerMiddleware;
|
|
64
|
-
this.#controller = options.controller;
|
|
65
|
-
this.#globalMatchers = options.globalMatchers;
|
|
66
|
-
this.#resource = this.#normalizeResourceName(options.resource);
|
|
67
|
-
this.#routesBaseName = this.#getRoutesBaseName();
|
|
68
|
-
this.#buildRoutes();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Normalizes the resource name to dropping leading and trailing
|
|
72
|
-
* slashes.
|
|
73
|
-
*/
|
|
74
|
-
#normalizeResourceName(resource) {
|
|
75
|
-
return resource.replace(/^\//, '').replace(/\/$/, '');
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Ensure resource name is not an empty string
|
|
79
|
-
*/
|
|
80
|
-
#validateResourceName(resource) {
|
|
81
|
-
if (!resource || resource === '/') {
|
|
82
|
-
throw new RuntimeException(`Invalid resource name "${resource}"`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Converting segments of a resource to snake case to
|
|
87
|
-
* make the route name.
|
|
88
|
-
*/
|
|
89
|
-
#getRoutesBaseName() {
|
|
90
|
-
return this.#resource
|
|
91
|
-
.split('.')
|
|
92
|
-
.map((token) => string.snakeCase(token))
|
|
93
|
-
.join('.');
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Create a new route for the given pattern, methods and controller action
|
|
97
|
-
*/
|
|
98
|
-
#createRoute(pattern, methods, action) {
|
|
99
|
-
const route = new Route(this.#app, this.#routerMiddleware, {
|
|
100
|
-
pattern,
|
|
101
|
-
methods,
|
|
102
|
-
handler: typeof this.#controller === 'string'
|
|
103
|
-
? `${this.#controller}.${action}`
|
|
104
|
-
: [this.#controller, action],
|
|
105
|
-
globalMatchers: this.#globalMatchers,
|
|
106
|
-
});
|
|
107
|
-
route.as(`${this.#routesBaseName}.${action}`);
|
|
108
|
-
this.routes.push(route);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Returns the `resource_id` name for a given resource. The
|
|
112
|
-
* resource name is converted to singular form and
|
|
113
|
-
* transformed to snake case.
|
|
114
|
-
*
|
|
115
|
-
* photos becomes photo_id
|
|
116
|
-
* users becomes user_id
|
|
117
|
-
*/
|
|
118
|
-
#getResourceId(resource) {
|
|
119
|
-
return `${string.snakeCase(string.singular(resource))}_id`;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Build routes for the given resource
|
|
123
|
-
*/
|
|
124
|
-
#buildRoutes() {
|
|
125
|
-
const resources = this.#resource.split('.');
|
|
126
|
-
const mainResource = resources.pop();
|
|
127
|
-
this.#params[mainResource] = ':id';
|
|
128
|
-
const baseURI = `${resources
|
|
129
|
-
.map((resource) => {
|
|
130
|
-
const paramName = `:${this.#getResourceId(resource)}`;
|
|
131
|
-
this.#params[resource] = paramName;
|
|
132
|
-
return `${resource}/${paramName}`;
|
|
133
|
-
})
|
|
134
|
-
.join('/')}/${mainResource}`;
|
|
135
|
-
this.#createRoute(baseURI, ['GET', 'HEAD'], 'index');
|
|
136
|
-
this.#createRoute(`${baseURI}/create`, ['GET', 'HEAD'], 'create');
|
|
137
|
-
this.#createRoute(baseURI, ['POST'], 'store');
|
|
138
|
-
this.#createRoute(`${this.#shallow ? mainResource : baseURI}/:id`, ['GET', 'HEAD'], 'show');
|
|
139
|
-
this.#createRoute(`${this.#shallow ? mainResource : baseURI}/:id/edit`, ['GET', 'HEAD'], 'edit');
|
|
140
|
-
this.#createRoute(`${this.#shallow ? mainResource : baseURI}/:id`, ['PUT', 'PATCH'], 'update');
|
|
141
|
-
this.#createRoute(`${this.#shallow ? mainResource : baseURI}/:id`, ['DELETE'], 'destroy');
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Filter the routes based on their partial names
|
|
145
|
-
*/
|
|
146
|
-
#filter(names, inverse) {
|
|
147
|
-
const actions = Array.isArray(names) ? names : [names];
|
|
148
|
-
return this.routes.filter((route) => {
|
|
149
|
-
const match = actions.find((name) => route.getName().endsWith(name));
|
|
150
|
-
return inverse ? !match : match;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Register only given routes and remove others
|
|
155
|
-
*/
|
|
156
|
-
only(names) {
|
|
157
|
-
this.#filter(names, true).forEach((route) => route.markAsDeleted());
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Register all routes, except the one's defined
|
|
162
|
-
*/
|
|
163
|
-
except(names) {
|
|
164
|
-
this.#filter(names, false).forEach((route) => route.markAsDeleted());
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Register api only routes. The `create` and `edit` routes, which
|
|
169
|
-
* are meant to show forms will not be registered
|
|
170
|
-
*/
|
|
171
|
-
apiOnly() {
|
|
172
|
-
return this.except(['create', 'edit']);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Define matcher for params inside the resource
|
|
176
|
-
*/
|
|
177
|
-
where(key, matcher) {
|
|
178
|
-
this.routes.forEach((route) => {
|
|
179
|
-
route.where(key, matcher);
|
|
180
|
-
});
|
|
181
|
-
return this;
|
|
182
|
-
}
|
|
183
|
-
tap(actions, callback) {
|
|
184
|
-
if (typeof actions === 'function') {
|
|
185
|
-
this.routes.forEach((route) => actions(route));
|
|
186
|
-
return this;
|
|
187
|
-
}
|
|
188
|
-
this.#filter(actions, false).forEach((route) => callback(route));
|
|
189
|
-
return this;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Set the param name for a given resource
|
|
193
|
-
*/
|
|
194
|
-
params(resources) {
|
|
195
|
-
Object.keys(resources).forEach((resource) => {
|
|
196
|
-
const param = resources[resource];
|
|
197
|
-
const existingParam = this.#params[resource];
|
|
198
|
-
this.#params[resource] = `:${param}`;
|
|
199
|
-
this.routes.forEach((route) => {
|
|
200
|
-
route.setPattern(route.getPattern().replace(`${resource}/${existingParam}`, `${resource}/:${param}`));
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
return this;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Prepend name to all the routes
|
|
207
|
-
*/
|
|
208
|
-
as(name, normalizeName = true) {
|
|
209
|
-
name = normalizeName ? string.snakeCase(name) : name;
|
|
210
|
-
this.routes.forEach((route) => {
|
|
211
|
-
route.as(route.getName().replace(this.#routesBaseName, name), false);
|
|
212
|
-
});
|
|
213
|
-
this.#routesBaseName = name;
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import Macroable from '@poppinss/macroable';
|
|
2
|
-
import type { Application } from '@adonisjs/application';
|
|
3
|
-
import type { Constructor, LazyImport, OneOrMore } from '../types/base.js';
|
|
4
|
-
import type { MiddlewareFn, ParsedNamedMiddleware, ParsedGlobalMiddleware } from '../types/middleware.js';
|
|
5
|
-
import type { GetControllerHandlers, RouteFn, RouteJSON, RouteMatcher, RouteMatchers, StoreRouteMiddleware } from '../types/route.js';
|
|
6
|
-
/**
|
|
7
|
-
* The route class exposes the APIs for constructing a route using the
|
|
8
|
-
* fluent API.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Route<Controller extends Constructor<any> = any> extends Macroable {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
|
|
13
|
-
pattern: string;
|
|
14
|
-
methods: string[];
|
|
15
|
-
handler: RouteFn | string | [LazyImport<Controller> | Controller, GetControllerHandlers<Controller>?];
|
|
16
|
-
globalMatchers: RouteMatchers;
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* Define matcher for a given param. If a matcher exists, then we do not
|
|
20
|
-
* override that, since the routes inside a group will set matchers
|
|
21
|
-
* before the group, so they should have priority over the group
|
|
22
|
-
* matchers.
|
|
23
|
-
*
|
|
24
|
-
* ```ts
|
|
25
|
-
* Route.group(() => {
|
|
26
|
-
* Route.get('/:id', 'handler').where('id', /^[0-9]$/)
|
|
27
|
-
* }).where('id', /[^a-z$]/)
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* The `/^[0-9]$/` will win over the matcher defined by the group
|
|
31
|
-
*/
|
|
32
|
-
where(param: string, matcher: RouteMatcher | string | RegExp): this;
|
|
33
|
-
/**
|
|
34
|
-
* Define prefix for the route. Calling this method multiple times
|
|
35
|
-
* applies multiple prefixes in the reverse order.
|
|
36
|
-
*/
|
|
37
|
-
prefix(prefix: string): this;
|
|
38
|
-
/**
|
|
39
|
-
* Define a custom domain for the route. We do not overwrite the domain
|
|
40
|
-
* unless `overwrite` flag is set to true.
|
|
41
|
-
*/
|
|
42
|
-
domain(domain: string, overwrite?: boolean): this;
|
|
43
|
-
/**
|
|
44
|
-
* Define one or more middleware to be executed before the route
|
|
45
|
-
* handler.
|
|
46
|
-
*
|
|
47
|
-
* Named middleware can be referenced using the name registered with
|
|
48
|
-
* the router middleware store.
|
|
49
|
-
*/
|
|
50
|
-
use(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
51
|
-
/**
|
|
52
|
-
* @alias use
|
|
53
|
-
*/
|
|
54
|
-
middleware(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
55
|
-
/**
|
|
56
|
-
* Give a unique name to the route. Assinging a new unique removes the
|
|
57
|
-
* existing name of the route.
|
|
58
|
-
*
|
|
59
|
-
* Setting prepends to true prefixes the name to the existing name.
|
|
60
|
-
*/
|
|
61
|
-
as(name: string, prepend?: boolean): this;
|
|
62
|
-
/**
|
|
63
|
-
* Check if the route was marked to be deleted
|
|
64
|
-
*/
|
|
65
|
-
isDeleted(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Mark route as deleted. Deleted routes are not registered
|
|
68
|
-
* with the route store
|
|
69
|
-
*/
|
|
70
|
-
markAsDeleted(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Get the route name
|
|
73
|
-
*/
|
|
74
|
-
getName(): string | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Get the route pattern
|
|
77
|
-
*/
|
|
78
|
-
getPattern(): string;
|
|
79
|
-
/**
|
|
80
|
-
* Set the route pattern
|
|
81
|
-
*/
|
|
82
|
-
setPattern(pattern: string): this;
|
|
83
|
-
/**
|
|
84
|
-
* Returns the stack of middleware registered on the route.
|
|
85
|
-
* The value is shared by reference.
|
|
86
|
-
*/
|
|
87
|
-
getMiddleware(): StoreRouteMiddleware[][];
|
|
88
|
-
/**
|
|
89
|
-
* Returns JSON representation of the route
|
|
90
|
-
*/
|
|
91
|
-
toJSON(): RouteJSON;
|
|
92
|
-
}
|