OpenFunction / functions-framework-go

Go functions framework for OpenFunction
18 stars 20 forks source link

Update Http Backend as mux is archived #68

Closed lizzzcai closed 1 year ago

lizzzcai commented 1 year ago

The gorilla/mux is in public archive mode due to lack of maintainers. We should switch to other implementations like fasthttp(used by Dapr) or other alternatives. If you have any good alternatives, please share them in the comment. Thanks.

benjaminhuo commented 1 year ago

@lizzzcai would you help with switching to fasthttp?

lizzzcai commented 1 year ago

@lizzzcai would you help with switching to fasthttp?

Hi @benjaminhuo , sure, I can help with it, will do it in January.

lizzzcai commented 1 year ago

@lizzzcai would you help with switching to fasthttp?

Hi @benjaminhuo , I quickly checked fasthttp yesterday, it probably does not fit here as it doesn't support request routing (path variables is not supported) and it is incompatible with net/http (need a converter), can find details here.

My idea is to find an alternative router which is compatible with net/http so that it will be easier to maintain and switch to another if the similar issue happens again. (dapr is switching from fasthttp to net/http).

One alternative I found is go-chi/chi, but I have to test if all the features we used in mux are implemented in chi, and the worse case is there will be some breaking changes, what do you think?

benjaminhuo commented 1 year ago

@lizzzcai would you help with switching to fasthttp?

Hi @benjaminhuo , I quickly checked fasthttp yesterday, it probably does not fit here as it doesn't support request routing (path variables is not supported) and it is incompatible with net/http (need a converter), can find details here.

My idea is to find an alternative router which is compatible with net/http so that it will be easier to maintain and switch to another if the similar issue happens again. (dapr is switching from fasthttp to net/http).

One alternative I found is go-chi/chi, but I have to test if all the features we used in mux are implemented in chi, and the worse case is there will be some breaking changes, what do you think?

@wanjunlei Are we using https://github.com/emicklei/go-restful in KubeSphere?

benjaminhuo commented 1 year ago

One alternative I found is go-chi/chi, but I have to test if all the features we used in mux are implemented in chi, and the worse case is there will be some breaking changes, what do you think?

chi looks good, we can give it a try. https://markphelps.me/posts/4-things-to-consider-when-choosing-a-go-api-framework/ It's indeed an alternative to gorilla/mux. The feature you want to use cannot be fulfilled by net/http right?

wanjunlei commented 1 year ago

@lizzzcai would you help with switching to fasthttp?

Hi @benjaminhuo , I quickly checked fasthttp yesterday, it probably does not fit here as it doesn't support request routing (path variables is not supported) and it is incompatible with net/http (need a converter), can find details here. My idea is to find an alternative router which is compatible with net/http so that it will be easier to maintain and switch to another if the similar issue happens again. (dapr is switching from fasthttp to net/http). One alternative I found is go-chi/chi, but I have to test if all the features we used in mux are implemented in chi, and the worse case is there will be some breaking changes, what do you think?

@wanjunlei Are we using https://github.com/emicklei/go-restful in KubeSphere?

Yes

lizzzcai commented 1 year ago

chi looks good, we can give it a try. https://markphelps.me/posts/4-things-to-consider-when-choosing-a-go-api-framework/ It's indeed an alternative to gorilla/mux. The feature you want to use cannot be fulfilled by net/http right?

example like"/hello/{name}" is not supported in net/http. chi looks lightweight and is actively maintained, I can give it a try first.