Move middlewares into handlers package #204
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to configure middlewares using the
NewService
function in a more straight forward way, themiddlewares
package has been moved intohandlers
.This means that the function
WrapEndpoints
is now in the same package asNewService
, allowing the middlewares to be configured with package level variables rather than cross package variables.This is not a complete solution, but rather an incremental improvement to the current configuration situation.
There was no real reason that
middlewares
became its own package, just a decision I made along the line. Both @zaquestion and @hasLeland agree that it makes sense to be part of the handlers package.To help with the transition, running these commands in the
NAME-service
directory in addition to rerunning truss should result in a all old middlewares still functioning.Additionally:
github.com/TuneLab/truss/gengokit/handler
togithub.com/TuneLab/truss/gengokit/handlers
NewEndpoints
to packagesvc/server