Using GWT as a RESTful frontend for a RESTful Go backend
Basically it doesn't work without hacks... The problem ist that the XMLHttpRequest cannot post or retrieve data to or from a location that isn't identical to the host where the application is running. So you can't run a GWT dev server on localhost:8888 and communicate with Go's backend which must run on a distinct port of you dev machine (e.g. localhost:8080). Of course you can compile your GWT frontend that communicates with the Go backend via REST and run it within the Go server environment. But this dev practice isn't exactly what's called "rapid" or even feasible at all.
In the case you want try it anyway: GWT's wrapper for XMLHttpRequest is the RequestBuilder class which is encouraged to be used instead of the raw XMLHttpRequest class which is available in GWT as well. You can find a nice explanation of how to use GWT as RESTful frontend in GWT's docs.
Yes, you can write GWT frontend code for Go without starting GWT's embedded Jetty (-noserver flag) server!
Post a Comment