DEV Community

Please recommend a restful API framework in Golang

Guo-Guang on May 02, 2018

Collapse
 
rhymes profile image
rhymes

I didn't use any, so I wouldn't know but one thing that I've noticed is that a lot of people don't and a lot of people do so you might want to research that a bit.

Strictly speaking, because how powerful the standard lib is, the only piece of framework you really need is the router and you can use gorilla mux for that.

gin seems a very populate HTTP framework on which you can build a REST API.

On dev.to @codehakase wrote a tutorial on how to build a web app with gin:

Collapse
 
taitung profile image
Guo-Guang

Nice. I found that gorilla mux has similar stuff like middleware in express or koa. I would probably start from gorilla mux and then other frameworks like gin if needed. Thank you, @rhymes

Collapse
 
pbnj profile image
Peter Benjamin (they/them)

Depending on the requirements of your REST API project:

  • If it's a small project that doesn't need sessions/cookies, database integrations ...etc, then the standard library is sufficient.
    • One step up from the standard library would be an unopinionated framework like gin
  • If it's a big project with time restraints/deadlines or requires features like database integrations, cookie/session management ...etc, then go with buffalo.
Collapse
 
taitung profile image
Guo-Guang

yeah, since the project I am going to apply Go is quite simple. I actually have been working MUX.

Collapse
 
gammpamm profile image
Gammpamm

I use a good boilerplate without a framework
github.com/dhax/go-base

Collapse
 
taitung profile image
Guo-Guang

that's the way when I get started working on Koa by using boilerplate...

Collapse
 
dselim profile image
Dorian Selimovic

I'd recommend Echo for its ease of use and comprehensive documentation.

Collapse
 
taitung profile image
Guo-Guang

this looks so shining. thanks @tommy8910

Collapse
 
ladydascalie profile image
Benjamin Cable

I would strongly sugest you rething using Iris.

Please view this:

florinpatan.ro/2016/10/why-you-sho...

My vote goes to either simply using mux, or Echo.

Thread Thread
 
taitung profile image
Guo-Guang

yeah i using mux for the first and simple Go project

Collapse
 
sainageswars profile image
Sai Nageswar Satchidanand

I would recommend using gRpc

  • Provides http/2
  • Provides streaming API
  • Auto-Generates clients.