Skip to content

Commit

Permalink
fix(ui5-utils-express): await the registration of middleware functions
Browse files Browse the repository at this point in the history
  • Loading branch information
petermuessig committed May 31, 2024
1 parent e4b6cab commit 74db418
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ui5-utils-express/lib/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ module.exports = function hook(name, callback, middleware) {
// when used inside a router, the hook can be only
// initialized with the first request for this route
let initializedByRouter = false;
const fn = function (req, res, next) {
const fn = async function (req, res, next) {
if (!initializedByRouter) {
const app = req.app;
// the server is usually derived from the app except in the
// approuter scenario, there we need to do the lookup at the
// approuter property in the app propery at the request
const server = app?.server || app?.approuter?._server?._server;
if (app && server) {
callback({
await callback({
app,
server,
on: server.on.bind(server),
Expand Down

0 comments on commit 74db418

Please sign in to comment.