Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

chore(refactor): remove return next() from router handlers #57

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

dtfiedler
Copy link
Collaborator

In koa, the use of next() allows for async middleware. It is not necessary, and actually creates unexpected behavior to use return next() within route handlers as it passes control flow to the next route that matches the request path, rather then returning the response. Going forward, next() is likely only needed in middlware, unless we have some special path chaining we are trying to do.

In koa, the use of `next()` allows for async middleware. It is not necessary, and actually creates unexpected behavior to use `return next()` within route handlers as it passes control flow to the next route that matches the request path, rather then returning the response. Going forward, `next()` is likely only needed in middlware, unless we have some special path chaining we are trying to do.
@dtfiedler dtfiedler requested a review from a team as a code owner November 20, 2023 14:26
@dtfiedler dtfiedler merged commit 3c427a0 into main Nov 20, 2023
6 checks passed
@dtfiedler dtfiedler deleted the route-handler-cleanup branch November 20, 2023 14:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant