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

🚀 [v3 Feature]: Interchangeable router with contribution packages #2202

Open
3 of 4 tasks
ReneWerner87 opened this issue Nov 10, 2022 · 6 comments
Open
3 of 4 tasks
Assignees

Comments

@ReneWerner87
Copy link
Member

ReneWerner87 commented Nov 10, 2022

Feature Description

🗣️ through user feedback we have learned that the syntax and behavior of route registration and expiration is a much discussed topic

depending on which frameworks/programming languages the developers have had good experiences with, they want syntax and behavior that is close to what they know and have had positive experiences with.

💡the idea

is to address the problem by creating the possibility to use different router syntax and/or behavior via contribution packages

with this it should be possible to use different concepts of route registration syntax like a laravel router or other routers like a radix tree router, which has a completely different behavior when processing the routes.

🔢 steps necessary to make it possible

  • a router interface must be created that includes the api's that the framework needs to run
  • all api's of the framework which are needed by the router have to be prepared for the expose to the outside (please design in a way that
    there are no major changes are expected in the future, so that backwards compatibility is always given)

📒 Sidenote:

  • the express router is the only one included in the core package, which also corresponds to the interface of the other routers.
  • this is used as default without thw need of any user configuration

❔ Not yet defined

  • the way the router will be registered is not yet clear
  • will prepare some proposals/examples
  • it is also unclear whether the app in the first level can still be used directly for routing or should always be called app.Router()

Related issues
#2190
#2200
#1829

Code Snippet (optional)

package main

import "github.com/gofiber/fiber/v2"
import "log"

func main() {
  app := fiber.New()

  // An example to describe the feature

  log.Fatal(app.Listen(":3000"))
}

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.
@ReneWerner87 ReneWerner87 self-assigned this Nov 10, 2022
@efectn efectn added this to the v3 milestone Nov 10, 2022
@efectn efectn added this to v3 Nov 10, 2022
@efectn efectn moved this to Todo in v3 Nov 10, 2022
@li-jin-gou
Copy link
Contributor

It looks very cool.

@wangjq4214
Copy link
Member

This is an idea that I have never seen before. I'm looking forward to it.

@sujit-baniya
Copy link
Contributor

I've tried implementing similar on the top of Goravel Framework
https://github.com/sujit-baniya/goravel/blob/master/app/helpers/view.go

I've used go-chi, gin-gonic and fiber router interchangeable

@mirusky
Copy link
Contributor

mirusky commented Nov 21, 2022

Hi @ReneWerner87 , I would like to know if you need any help in the flavored fiber versions... I was thinking in something like the adaptor but for the whole app like:

package main

import (
    "github.com/gofiber/fiber/v2"
    "flavours/laravel"
)

func main() {
   app := laravel.New(fiber.New())

   // now here the router looks like laravel way 

   app.Listen(":3000")
}

So in that way each flavor works as a "proxy" to the real fiber app. Each flavor has its own use cases and syntax. What you think?

@ReneWerner87
Copy link
Member Author

will start with the implementation on wednesday

after that i might need help for the adaptor

@ReneWerner87 ReneWerner87 moved this from Todo to In Progress in v3 Nov 22, 2023
@ReneWerner87
Copy link
Member Author

current state
main...v3-Interchangeable-router

this feature is bigger than expected and unfortunately will not be developed in v3

we first have to standardize everything step by step
besides, the gain is not too big and the usage probably only reaches a small niche of developers

our plan is to enable major changes more quickly in the future, as other large software companies have done in recent years

so that our breaking changes are not a problem in the future and this can be driven forward slowly

@efectn efectn removed the status in v3 Apr 28, 2024
@efectn efectn removed this from the v3 milestone May 24, 2024
@efectn efectn removed this from v3 May 24, 2024
@efectn efectn removed the v3 label May 24, 2024
@efectn efectn moved this to Idea/Verify in Ideas/Maintainance May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Idea/Verify
Development

No branches or pull requests

6 participants