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

Process routes after middleware #168

Merged
merged 7 commits into from
Jul 4, 2017

Conversation

jimlambie
Copy link
Contributor

@jimlambie jimlambie commented May 14, 2017

This PR ensures that:

  1. a request is passed through all middleware functions before the app-specific routes are examined. Prior to this a request was tested against all loaded page components at the beginning of the request, and an array of matching routes was added to the middleware stack. With this change, matching app-specific routes are looked for only if processing the middleware stack yields no valid handlers. This means that static files will be handled by serve-static before any app routes are looked up.

  2. requests for static files are now passed through the request logger:

04:09:48.920Z  INFO dadi-web: GET / 200 10ms (module=router)
04:09:48.935Z  INFO dadi-web: GET /styles.css 200 5ms (module=router)
04:09:48.938Z  INFO dadi-web: GET /logo.png 200 8ms (module=router)
04:09:59.077Z  INFO dadi-web: GET /test.txt 200 3ms (module=router)
04:09:59.123Z  INFO dadi-web: GET /favicon.ico 200 2ms (module=router)

Fix #165

@jimlambie jimlambie requested review from eduardoboucas and fra967 May 15, 2017 00:05
@jimlambie jimlambie merged commit 7f61043 into master Jul 4, 2017
@jimlambie jimlambie deleted the feature/process-routes-after-middleware branch July 4, 2017 12:28
@abovedave abovedave mentioned this pull request Aug 8, 2017
3 tasks
@jimlambie jimlambie restored the feature/process-routes-after-middleware branch August 10, 2017 14:50
abovedave pushed a commit that referenced this pull request Aug 10, 2017
abovedave pushed a commit that referenced this pull request Aug 10, 2017
abovedave pushed a commit that referenced this pull request Aug 10, 2017
abovedave pushed a commit that referenced this pull request Aug 10, 2017
@jimlambie jimlambie deleted the feature/process-routes-after-middleware branch September 13, 2017 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants