Best API-only framework

(Giovanni) #1

Hi Gophers!

I’m a developer approaching Go as a 2018 goal. I have years of experience in Javascript and Ruby (Rails in particularly). So I’m here to ask you:

what is the best framework to build a REST API-only web project in Go?

Thank you!

(Norbert Melzer) #2

Plain old net/http.

At least unless you need very fancy stuff for the routing. Back when I built something for university, I used some router though which automatically generated proper options routes. I will look up how this lib was called when I’m back at a computer and have access to those sources.

(Norbert Melzer) #3

I took a look and the router I used was, mainly because the project for the university had strict requirements that I was able to fullfil by simply setting some options in that router (redirect for trailing slash and a proper response to OPTIONS requests).

(Roman Grytskiv) #4

The simplest way is to start with standard HTTP library. You can add bonus components later depending on what you need. The common choices for lightweight mix-ins are gorilla/mux for routing and sqlx for simpler DB access.

On the other hand, you can use a more opinionated framework, like gin.

Also, you may want to check a good discussion of this topic on reddit.

(Marc Zahn) #5

What is this framework supposed to contain? Just the http part?

(Giovanni) #7

FYI I ended up using Gin. I’m loving it so far :slight_smile: any suggestions about Gin?

(Pieter Louw) #8

If you’re coming from Rails then you will feel at home wtih Go Buffalo.

buffalo new myapp --api

(Boban Acimovic) #9

My favorite is chi.

(Diego Bernardes) #10

Like @acim told, take a look at chi, it almost the std lib with goodies included like router and middleware. I have used gin, echo and some others, chi, by far, was the best.

(system) #11

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.