Building a Web App With Go, Gin and React

Francis Sunday on April 21, 2018

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... [Read Full]
 

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 :

r.GET("/teachers/list", func (c *gin.Context){})
r.GET("/teachers/:id/profile", func (c *gin.Context){})

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 server

 

Hello, 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'

 

Looks quite extensive! Definitely going to need to check this out later. Bookmarked!

 
 

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...

 
 
 
 
 

You're welcome Sam! I'm glad you liked it :)

 

Why use external service for auth and not the Go server itself?

 

The article was focused on that particular service integration.

 
 

Hi Francis, Excellent read! Thank you very much, I learned a lot. Especially the second part was something completely new to me.

Gin seems to be a nice small framework. I definitely gonna try it out.

 

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

code of conduct - report abuse