Re: How to Create Two Routes in Golang App.yaml in conjunction with React

26 views
Skip to first unread message
Message has been deleted

Nicolas (Google Cloud Platform Support)

unread,
Aug 21, 2019, 6:50:11 PM8/21/19
to Google App Engine

Hi Daniel,

Thanks for opening this thread, however as you said this channel is not intended for technical questions. I see that you now have some people helping you on your StackOverflow and I hope you find the solution to your issue as soon as possible.


On Tuesday, August 20, 2019 at 5:50:05 PM UTC-4, Daniel Connelly wrote:
I apologize if I'm asking a technical question and this isn't the place for it (I have already posted to Stackoverflow, but response hasn't been active). I have a flex app I have been tinkering with for some time written in Go and React with two routes:

Enter code here...
func main
() {
  http
.Handle("/", http.FileServer(http.Dir("./app/build")))
  http
.HandleFunc("/search", searchcontract.SearchContract)
  http
.ListenAndServe(":8080", nil)
}
The first handle starts the React App/Element up.
The second handleFunc queries a database and returns the results to the react element.
Behavior is correct on localhost:8080.
What happens when I deploy the app is that the Go app never interacts with the React element appropriately. React receives a status code of '0', which I believe means that Go never sent any resposneto a requested query. I believe this is true because I tested it locally: when I start the React app up without the Go server, this is the status code React receives.

Localhost works fine:

working.png


App Engine doesn't query correctly (Not in this picture: when I decide to show the table, the status returned is 0):

notworking.png

The problem is not with my Mysql database. I know this because when I route all requests to the /seach function i receive back this:

online.png


Any help is appreciated!

Daniel Connelly

unread,
Aug 21, 2019, 7:47:15 PM8/21/19
to Google App Engine
Nicolas,
Thank you for your kind reply. The problem is resolved as well :).

Cheers,
Daniel
Reply all
Reply to author
Forward
0 new messages