Is your feature request related to a problem?
Hi, I'd like to use fiber on a unix socket.
Describe the solution you'd like
The most natural way to do this is to add (app *App) Serve(ln net.Listener) function.
Describe alternatives you've considered
Also an alternative could be to expose the app.newServer() and then use app.NewServer().Serve(ln) on the listener.
Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you want to chat with us or need help, join us on our Discord server: https://gofiber.io/discord
We could add this for v1.9.0 馃憤
But should we accept a net.Listener inside the app.Listen() method as first parameter?
https://fiber.wiki/application#listen since it accepts an interface{} already.
It currently supports int & string address, we could add net.Listener to this.
ln, _ := net.Listen("tcp", ":8080")
app.Listen(ln)
app.Listen(8080)
app.Listen("8080")
app.Listen(":8080")
app.Listen("127.0.0.1:8080")
Or we add a separate method app.Serve(ln net.Listener)
ln, _ := net.Listen("tcp", ":8080")
app.Serve(ln)
app.Listen(8080)
What do you guys think?
Both are okay, but I think it's better to have a separate method.
app.Serve(ln net.Listener) is better, I think it should be the method that allow users custom what they want as much as possible.
But I'm interested in how to combine fiber's listener which created from app.prefork() or net.Listen() with user's custom listener, since tls.NewListener() only allow nest (or wrap) a single listener?
@mthli, good point. The app.Serve(ln net.Listener) cannot support the preforking feature. If we add this to the docs, it should be no problem.
Most helpful comment
Both are okay, but I think it's better to have a separate method.