Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req.app is not a reference to the slay.App #15

Open
chrisajimenez opened this issue Oct 6, 2020 · 0 comments
Open

req.app is not a reference to the slay.App #15

chrisajimenez opened this issue Oct 6, 2020 · 0 comments

Comments

@chrisajimenez
Copy link

Problem

I am trying to access app.config that is exposed by slay inside of a middleware, but it doesn't exist. Express exposes both req.app and res.app for this purpose.

Example:

// foo-middleware.js
module.exports = foo(req, res, next) {
  // req.app exists
  // req.app.config does not exist
  next();
}

Investigation

This reference is not updated in slay, and does not have a reference to the new app properties that are documented.

req.app and res.app seem to be set on the prototype of express's app as a re-writable property. Happy to open up a PR to change this in slay, unless there is another way to access the slay app instance from inside of a middleware. (to get access to app.config, for example). This should work by setting app.request.app = app (the slay app instead of the express app).

It looks like slay and broadway inherit properties from express, but don't update this app.request.app reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant