-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🔥 Consider strong typing for API #178
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! |
Fiber started as a personal project to be able to rewrite all my node apps into Go. I tried to stick to the same workflow as Express by using interfaces when a function had multiple purposes, now I know that this is not the best way to go. I thought about going with a 100% strong typed API weeks ago, but Fiber got a lot of users within a short period of time. So changing Fiber to be a fully strong typed framework will break the current API, but we can take notes for |
I see. In my case I added And not to mention I'm a member of strongly typed camp. 😄 |
agree,Fiber made it easy for me to migrate from nodejs to Go。
Now, it's true that docs are often needed ,and Some exceptions can only be caught at runtime. |
I have discussed this with @koddr, and we want to share our conclusion on this matter. Most methods that use the Now there are some When you managed to understand the Route handlers, you are left with these I started working on clarifying some We can change all This is a big change, and I might create an Poll for this and take a vote. |
I like that 👍 I think having strong typing could cleanup I cant help with some PRs if you have something specific in mind. |
Thanks @alex-shpak for your input, all suggestions will be addressed in v1.8.0. PS: We went with app.Get("/", secretpage(), auth())
// Might cause unintended results since auth() will run after the secretpage
app.Get("/", auth(), secretpage())
// We think with the current arg types this will be encouraged. I'm closing this issue because |
Is your feature request related to a problem?
Hi!
In Go (IMO) it is considered bad practice to use
interface{}
if strongly typed API can be implemented.I understand that idea is to have similarity with the
expressjs
library, but now developer has to visit documentation/source to identify what are proper params types for the routing function.Also I think strongly typed API is one of things developers look after when choosing framework. It also can decrease amount of runtime checks and will show errors/mistypes during compile time.
Describe the solution you'd like
As an example for routing function:
Describe alternatives you've considered
Leave it as it is ¯\(ツ)/¯
The text was updated successfully, but these errors were encountered: