This article was originally posted on My Blog
TL;DR: In this tutorial, I'll show you how easy it is to build a web application with Go and the G...
For further actions, you may consider blocking this person and/or reporting abuse
Many thanks for this great blog post!
We've been using Gin as our web framework in production, and while it holds up very well under high load, we've seen some issues with the router used within the framework. The issue is detailed in github.com/gin-gonic/gin/issues/388
In brief, if you have two routes defined as follows, you'll see a runtime panic :
This is because gin's built-in router (based on httprouter) can't handle such wildcard based routing properly. As a result, RESTful services are difficult to define around resource names.
I've been exploring alternatives to using gin, and it seems like go-chi is the most simple and idiomatic router around. It could successfully handle such wildcard based routing. Furthermore, it uses the native Go context object (rather than Gin's custom context object), and its middlewares and handlers are portable across other routing libraries such as gorilla/mux (in case you want to change in the future).
Some comparisons between simple Go http routers made by me in this repo
I had an issue and is the next:
"Error parsing token: Invalid issuer."
I followed all the steps and I don't have a clue what could be my problem, I made the right configuration on auth0 and I got all the right credencial from it, Any advise?
I new in all these (Go,Gin and React)! and this post is the best that I have found so far!
Thanks for the time you took it to make it!
Hello there Christopher! Glad you checked out the article.
The error message, That's coming from the method that validates the token sent from the Auth0 client. Confirm you have the
.env
file setup and source on runtime with the Go serverHello, I ran into this same issue. The solution on my side was that although on the Auth0 site the domain is listed as 'example.auth0.com' in the .env and app.jsx files it needed to be set to 'example.auth0.com'
Hi Justin, I am getting the "Error parsing token: invalid issuer". I think I have set the right domain which is "username.us.auth0.com". And I didn't get your solution to this problem. Can you please explain again?
Nice post! I successfully setup a simple application with your example without any problem. But now I have a question beyond the scope of this article: I want to setup some React router e.g.: having a /jokes for the page in your example. but gin is unable to comprehend the url /jokes (vs. the previous /) and return a 404. is there a way to setup the route in gin to also respect the routes defined in React router?
Thanks!
Did some research on serving React with static file (create-react-app.dev/docs/deployme...), so basically I have to define the client side routing paths in the go server, and point them to the same static files, e.g.:
router.Use(static.Serve("/jokes", static.LocalFile("./views", true)))
Also because gin doesn't support path regex, I have to either customize a handler for that case or define all my client side routing on the go backend. a bit tedious, but that works! :)
github.com/gin-gonic/gin/issues/229
Looks quite extensive! Definitely going to need to check this out later. Bookmarked!
Great
For real though, pretty sure this post could replace this book:
Cloud Native Go: Building Web Applications and Microservices for the Cloud with Go and React (Developer's Library) amazon.com/dp/0672337797/ref=cm_sw...
Thank you Francis for providing the detailed information about web application development. The blog was absolutely amazing! Lot of information which can be useful for web app users, Keep it up. bit.ly/2RHSivk
This is amazing! Thank you so much Francis!
You're welcome Sam! I'm glad you liked it :)
Hello Nico!
I'm glad you enjoyed reading this piece of mine. Do try it out, and also explore other libraries available in the Go ecosystem, Good luck :D
Awesome post, you went into great detail!
Thank you Lan, I'm glad you liked it :)
Great, great post ! Thanks
Thanks Leo
Thanks for sharing. It's a great work.
Thanks, I'm glad you liked it José.
Are you sure it's safe to store JWT in localstorage? From my understanding, this is vulnerable to any XSS attack. Apart from that, I liked the tutorial!
Are you sure it's safe to store JWT in localstorage? From my understanding this is vulnerable to XSS attacks. Apart from that, I liked the tutorial!
Thanks a lot.
You're welcome ☺
Why use external service for auth and not the Go server itself?
The article was focused on that particular service integration.
I tried to run and got "unknown field 'SigninMethod' in struct literal of type jwtmiddleware.Options". Any clues on how to solve It?
well that jokes are very funny...