-
Notifications
You must be signed in to change notification settings - Fork 62
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
use of a web framework #25
Comments
For now, I'm using this hack which creates a new |
Hi there. Can you give an example of what you would want the API to do? Right now, when you register functions with So, if you wanted to handle the routing yourself, we could either expose the wrappers (basically middleware) or we could let you provide a custom |
For instance, I would like to create multiple sub-paths for a given "API" / function. Yes, exposing the wrappers sounds to be a nice option. But as I'm new to Go lang, feel free to decide on your own :) |
If you're using Cloud Functions directly, you won't need to use this Functions Framework. The Functions Framework would be helpful in case you want to convert existing functions to run on another platform, like App Engine or Cloud Run. That said, I think exporting the functionality to convert a handler to a "event" handler is a reasonable feature request. Then, you would be completely responsible for your own routing and starting a server. @juliehockett @grant, thoughts? |
I'm not sure of the specific issue. It's not clear from the GitHub issue. What's the desired behavior? Is this the question?:
For Node, it's easy to use a custom URL router atop the Functions Framework. I show an example in this blogpost: I don't know if Go has such a package, but I would imagine using a lightweight router would answer this question. |
Hello, yes that's definitely the point. I also built a NodeJS function with a set of endpoints routed thanks to the Express lib. But I'm looking for a similar way of working with Go. My nodeJS version with express: https://github.com/bcollard/gcloud-functions-nodejs-claps |
@grant, for Go, instead of picking a particular framework for routing, etc., the change here would be to export a version of this function that users can use to wrap an
|
Further think with this, URL routing and middleware is really not a feature of functions. With a serverless function, we really expect one route, and not a whole web framework / API. If you're interested in that, we recommend Cloud Run, which has more flexibility and is recommended for building with a web framework and features like routing and middleware. The Node framework may support Express middleware as an artifact, but that's not really a purposeful design. Going to close this issue, but feel free to comment or suggest re-opening and I can re-open. |
Hello,
Is it possible to use a web framework (for routing & middleware) like gorilla/mux or gofiber/fiber when using the functions-framework for go?
I can't figure out how to configure the main.go in such case, so maybe one just can't do that on local development machine?
(I've first given a try to functions-framework-nodejs and I could take advantage of Express.js both on local machine and on GCP Functions)
The text was updated successfully, but these errors were encountered: