Skip to content

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

@chrisajimenez

Description

@chrisajimenez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions