@adonisjs/http-server 6.8.2-1 → 6.8.2-2
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.
|
@@ -23,7 +23,7 @@ export class BriskRoute extends Macroable {
|
|
|
23
23
|
return this.route;
|
|
24
24
|
}
|
|
25
25
|
redirect(identifier, params, options) {
|
|
26
|
-
return this.setHandler(async (ctx)
|
|
26
|
+
return this.setHandler(async function redirectsToRoute(ctx) {
|
|
27
27
|
const redirector = ctx.response.redirect();
|
|
28
28
|
if (options?.status) {
|
|
29
29
|
redirector.status(options.status);
|
|
@@ -32,7 +32,7 @@ export class BriskRoute extends Macroable {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
redirectToPath(url, options) {
|
|
35
|
-
return this.setHandler(async (ctx)
|
|
35
|
+
return this.setHandler(async function redirectsToPath(ctx) {
|
|
36
36
|
const redirector = ctx.response.redirect();
|
|
37
37
|
if (options?.status) {
|
|
38
38
|
redirector.status(options.status);
|
|
@@ -29,8 +29,8 @@ export declare class Router extends LookupStore {
|
|
|
29
29
|
patch<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
|
|
30
30
|
delete<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
|
|
31
31
|
group(callback: () => void): RouteGroup;
|
|
32
|
-
resource(resource: string, controller: string): RouteResource;
|
|
33
|
-
shallowResource(resource: string, controller: string): RouteResource;
|
|
32
|
+
resource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource;
|
|
33
|
+
shallowResource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource;
|
|
34
34
|
on(pattern: string): BriskRoute;
|
|
35
35
|
where(param: string, matcher: RouteMatcher | string | RegExp): this;
|
|
36
36
|
commit(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Macroable from '@poppinss/macroable';
|
|
2
2
|
import type { Application } from '@adonisjs/application';
|
|
3
3
|
import { Route } from './route.js';
|
|
4
|
+
import type { Constructor, LazyImport } from '../types/base.js';
|
|
4
5
|
import type { ParsedGlobalMiddleware } from '../types/middleware.js';
|
|
5
6
|
import type { ResourceActionNames, RouteMatcher, RouteMatchers } from '../types/route.js';
|
|
6
7
|
export declare class RouteResource extends Macroable {
|
|
@@ -8,7 +9,7 @@ export declare class RouteResource extends Macroable {
|
|
|
8
9
|
routes: Route[];
|
|
9
10
|
constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
|
|
10
11
|
resource: string;
|
|
11
|
-
controller: string
|
|
12
|
+
controller: string | LazyImport<Constructor<any>> | Constructor<any>;
|
|
12
13
|
globalMatchers: RouteMatchers;
|
|
13
14
|
shallow: boolean;
|
|
14
15
|
});
|
|
@@ -42,7 +42,9 @@ export class RouteResource extends Macroable {
|
|
|
42
42
|
const route = new Route(this.#app, this.#routerMiddleware, {
|
|
43
43
|
pattern,
|
|
44
44
|
methods,
|
|
45
|
-
handler:
|
|
45
|
+
handler: typeof this.#controller === 'string'
|
|
46
|
+
? `${this.#controller}.${action}`
|
|
47
|
+
: [this.#controller, action],
|
|
46
48
|
globalMatchers: this.#globalMatchers,
|
|
47
49
|
});
|
|
48
50
|
route.as(`${this.#routesBaseName}.${action}`);
|