opensauceryafrica/barf

Inquiry About Routing

alob-mtc opened this issue · 2 comments

Hello @opensaucerer nice work with the project.
i see that https://github.com/opensaucerer/barf/blob/50eda180244c542693e89a29d06267bcaa738846/router/func.go#L9 is the routing implementation, but also noticed the func is not been referenced or used anywhere in the code base.

Could you point me to where the routing is actually done. Thanks

Hey @alob-mtc just seeing this. My apologies for the delayed response...been pretty off these past few weeks.

You are right that Func() is the routing implementation but that stopped being valid as of the latest release Jarvis - v1.0.8.
https://github.com/opensaucerer/barf/releases/tag/v1.0.8

With the new release, route functions are now converted into middleware inherently. You can see this line for how that happens
https://github.com/opensaucerer/barf/blob/50eda180244c542693e89a29d06267bcaa738846/router/register.go#L9

The reason for this is because it becomes a lot more maintainable going forward since the idea is to not obstruct any flow and we simply want Go's ServeHTTP to be the prevailing caller as implemented in this logic below.
https://github.com/opensaucerer/barf/blob/50eda180244c542693e89a29d06267bcaa738846/router/middleware.go#L15

Closing now. I guess this is resolved @alob-mtc
You can re-open again if needed.
Thank you.