File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -206,14 +206,14 @@ export function notFound() {
206
206
207
207
// Router ----------------------------------------------------------------------
208
208
209
- export function router ( ...handlers : RouteHandler < HttpMethod , any , ResponseBodyType > [ ] ) {
210
- return async function ( req : ServerRequest , res : ServerResponse ) {
209
+ export function router ( ...handlers : RouteHandler < HttpMethod , any , ResponseBodyType > [ ] ) : Handler {
210
+ return async function ( req , res ) {
211
211
for ( const current of handlers ) {
212
212
if ( req . method !== current . method ) continue
213
213
const match = current . matchPath ( req . parsedURL . pathname )
214
214
if ( ! match ) continue
215
215
req . params = match . params
216
- await current ( req as ServerRequest < any > , res )
216
+ return await current ( req as ServerRequest < any > , res )
217
217
}
218
218
return send ( res , 404 , 'Not Found' )
219
219
}
You can’t perform that action at this time.
0 commit comments