Skip to content

Asset handler as a web server for existing frontend application #2020

Answered by mholt
emcfarlane asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah, that works. AFAIK the built-in server will pass along anything that doesn't match a static asset to AssetHandler. Oh, but websockets won't work. Those will have to be transitioned to Events (I have yet to do this).

I decided to eliminate HTTP for my Wails GUI though. It wasn't a lot of work since my HTTP handlers were basically: 1) decode the request, 2) call the function, 3) write the HTTP response. I just split out step (2) so JS can call it directly. It's so nice to be able to simply call a function in JS and have the response as a native JS value without having to deal with HTTP status codes, etc; and my Go code can just do its thing and return error values, without having to wo…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@emcfarlane
Comment options

Answer selected by emcfarlane
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants