gofiber / fiber

⚑️ Express inspired web framework written in Go
https://gofiber.io
MIT License
34.13k stars 1.68k forks source link

πŸš€ [v3 Feature]: Interchangeable router with contribution packages #2202

Open ReneWerner87 opened 2 years ago

ReneWerner87 commented 2 years ago

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

πŸ“’ Sidenote:

❔ Not yet defined

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:

li-jin-gou commented 2 years ago

It looks very cool.

wangjq4214 commented 2 years ago

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

sujit-baniya commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

will start with the implementation on wednesday

after that i might need help for the adaptor

ReneWerner87 commented 8 months ago

current state https://github.com/gofiber/fiber/compare/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