File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -206,14 +206,14 @@ export function notFound() {
206206
207207// Router ----------------------------------------------------------------------
208208
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 ) {
211211 for ( const current of handlers ) {
212212 if ( req . method !== current . method ) continue
213213 const match = current . matchPath ( req . parsedURL . pathname )
214214 if ( ! match ) continue
215215 req . params = match . params
216- await current ( req as ServerRequest < any > , res )
216+ return await current ( req as ServerRequest < any > , res )
217217 }
218218 return send ( res , 404 , 'Not Found' )
219219 }
You can’t perform that action at this time.
0 commit comments