Comments (4)
Yes, you should be able to add a framework layer as long as it can take the http.Handler
interface.
Using that specific library, it would look something like this:
func main() {
flag.Parse()
goji.Handle(nodego.HTTPTrigger, func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, I'm native Go!")
})
DefaultMux.Compile()
http.Handle("/", DefaultMux)
nodego.TakeOver()
}
However, I don't see much of a purpose since there is only one url you can handle on GCF (i.e. /execute
).
from cloud-functions-go.
Are you sure about that latter part of your comment, @ssttevee? If I deploy a Google Cloud Function written in Go and call /foo/bar/zoink
on the base URL, it gets received as /execute/foo/bar/zoink
in my http.Handler
.
To make that work with my custom router I just need to strip away /execute
from r.URL.Path
and r.RequestURI
.
from cloud-functions-go.
@prep, are you asking how to strip the path?
from cloud-functions-go.
@iangudger, I was saying that the latter part of @ssttevee's comment seems to suggest that a function is only been given a singular URL path, namely /execute
, and therefore an alternative HTTP router doesn't make much sense.
In my experience, you can serve many paths from your function with the only caveat that all URL paths have the /execute
prefix to them which I suggested can be stripped away before they hit your router (by way of stripping them in ServeHTTP()
, for example).
from cloud-functions-go.
Related Issues (20)
- about function-go HOT 6
- How to log to GCP Stackdriver? HOT 18
- currently only allow one main.go HOT 3
- cross projects permissions HOT 6
- there are any update? HOT 6
- Function always dies when issuing HTTP(S)-Requests with nodego.OverrideLogger() HOT 3
- Deployment failure: Operation interrupted. HOT 24
- Error: could not handle the request HOT 10
- NodeJS, PassportJS or JWT in Google Cloud Functions HOT 1
- Official Golang support plans? HOT 6
- Can't deploy function to Google Cloud Platform HOT 6
- How to deploy function to local emulator? HOT 2
- PubSub trigger `json: cannot unmarshal object` HOT 6
- Can't get this package. HOT 3
- Deployment issues HOT 9
- Official Go support is in public beta
- Why vendor folder is ignored (go project) HOT 1
- Deployment failure without invisibility! HOT 2
- Use Real Cloud Functions Go Runtime, Not Fake One HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloud-functions-go.