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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃 How to modify fiber.Ctx? #152

Closed
ThisIsMissEm opened this issue Feb 17, 2020 · 2 comments
Closed

馃 How to modify fiber.Ctx? #152

ThisIsMissEm opened this issue Feb 17, 2020 · 2 comments

Comments

@ThisIsMissEm
Copy link

Question description

In Express, it's possible to dangle any sort of custom methods or properties from the request/response objects via middleware. I can't see anything in the documentation of how to do this in Fiber.

For instance, I want to write middleware that deals with some authentication that gives me an API in my route handlers that allows me to check for permissions or call an upstream service, how would this be done?

@welcome
Copy link

welcome bot commented Feb 17, 2020

Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template!

@Fenny
Copy link
Member

Fenny commented Feb 17, 2020

We are planning to add a feature to extend the Ctx struct, but this will be released in v2.
For now you could use a function called Locals for passing data between middlewares.

Click here for an example, does this help?

@Fenny Fenny closed this as completed Feb 18, 2020
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

2 participants