Skip to content

Commit

Permalink
feat: share applicable route rules across handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 30, 2022
1 parent 34424d3 commit da12900
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function createNitroApp (): NitroApp {

h3App.use(eventHandler((event) => {
const routeOptions = routerOptions.lookup(event.req.url) || {}
// Share applicable route rules across handlers
event.context.routeOptions = routeOptions
if (routeOptions.redirect) {
return sendRedirect(event, routeOptions.redirect.to || routeOptions.redirect, routeOptions.redirect.statusCode || 307)
}
Expand Down

0 comments on commit da12900

Please sign in to comment.