File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,4 @@ export { HttpException } from './src/exceptions/http_exception.js'
2222export { AbortException } from './src/exceptions/abort_exception.js'
2323export { RouteNotFoundException } from './src/exceptions/route_not_found.js'
2424export { CannotLookupRouteException } from './src/exceptions/cannot_lookup_route.js'
25+ export { defineMiddleware , defineNamedMiddleware } from './src/define_middleware.js'
Original file line number Diff line number Diff line change 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+
10+ import type { LazyImport } from './types/base.js'
11+ import type { MiddlewareAsClass } from './types/middleware.js'
12+
13+ /**
14+ * Define an array of midldeware to be used either by the server
15+ * or the router
16+ */
17+ export function defineMiddleware ( list : LazyImport < MiddlewareAsClass > [ ] ) {
18+ return list
19+ }
20+
21+ /**
22+ * Define an collection of named middleware. The name can be later be
23+ * referenced on the routes
24+ */
25+ export function defineNamedMiddleware <
26+ NamedMiddleware extends Record < string , LazyImport < MiddlewareAsClass > >
27+ > ( collection : NamedMiddleware ) {
28+ return collection
29+ }
You can’t perform that action at this time.
0 commit comments