API Resources for Go Developers
Go originated as a systems programming language. It takes the best of compiled statically typed languages like C and combine it with garbage collection. Go has some elegant features baked in for concurrency such as goroutines and channels.
As a high performance systems language supporting concurrency, Go is popular with high volume HTTP proxies and gateways along with lower level code like Docker and Kubernetes. While not popular with application programming and APIs yet, it’s usage is growing, especially as new frameworks mature. As a systems language, Go is not suited for data manipulation problems in data oriented applications due to limited constructs.
Background on Go
Popular Web Frameworks
You can develop RESTful APIs without using frameworks, usually use one of the frameworks can make it a lot easier.
Go-Lang have several frameworks of varying popularity.
- Beego - an open source framework to build and develop your applications in the Go way.
- Buffalo - rapid web development with Go.
- Echo - a minimalistic Go Web Framework.
- Gin - featuring a Martini-like API.
- Iris - claim to be the fastest web framework for Go, supporting MVC.
- Revel - a full-stack web framework for Go-Lang.
Tutorials for Creating RESTFul APIs
Like most web pages, you usually build APIs on tops of an existing framework. The most popular frameworks in PHP are Laravel and CodeIgniter.
-
Gorrilla
Gorrilla Webtool kit isn’t exactly a framework, still it have the key components needed for building RESTful APIS.
-
No Framework
-
Beego
-
Gin
Tutorials for Creating GraphQL APIs
GraphQL is promoted as an alternative to RESTful API, you can read more about the background on GraphQL, and other types of APIs here.
- Walkthough creating a blogging GraphQL API using Go and PostgreSQL
- A more advanced GraphQL tutorial
- A tutorial on GraphQL using Go and Neo4j, a graph database
Tutorials for Deployment
-
Heroku
-
AWS
-
Google App Engine
Azure seems to ended official support for Go according to announcement here.
Useful Libaries
-
Documentation
-
Authentication
- authboss - modular authentication system for the web.
- casbin - Authorization library that supports access control models like ACL, RBAC, ABAC.
- go-jose - implementation of the JOSE working group’s JSON Web Token, JSON Web Signatures, and JSON Web Encryption specs.
- go-oauth2-server - Standalone, specification-compliant, OAuth2 server written in Golang.
- gologin - chainable handlers for login with OAuth1 and OAuth2 authentication providers.
- goth - provides a simple, clean, and idiomatic way to use OAuth and OAuth2. Handles multiple providers out of the box.
- jwt - implementation of JSON Web Tokens (JWT).
- jwt-auth - JWT middleware for Golang http servers with many configuration options.
- jwt-go - Golang implementation of JSON Web Tokens (JWT).
- loginsrv - JWT login microservice with plugable backends such as OAuth2 (Github), htpasswd, osiam.
- oauth2 - successor of goauth2. Generic OAuth 2.0 package that comes with JWT, Google APIs, Compute Engine and App Engine support.
- osin - Golang OAuth2 server library.
- paseto - Golang implementation of Platform-Agnostic Security Tokens (PASETO)
- sessiongate-go - Go session management using the SessionGate Redis module.
- sessions - highly customizable sessions service for go http servers
-
CORS
- CORS - CORS middleware for your APIs.
-
JSON
- json - within the standard library
- jsonparser - alternative parser that does not require schema.
- Jason - easy to use JSON library for go.
- easyjson - a fast way to marshal/unmarshal JSON.
-
Databases, Query Builder and ORMs
- dat - Postgres Data Access Toolkit.
- Dotsql - keep sql files in one place for easy usage.
- gendry - SQL builder and data binder.
- goqu - idiomatic SQL builder and query library.
- igor - abstraction layer for PostgreSQL that supports advanced functionality and uses gorm-like syntax.
- ozzo-dbx - data retrieval methods with DB-agnostic query building capabilities.
- scaneo - Generate Go code to convert database rows into arbitrary structs.
- sqrl - fork of Squirrel with improved performance.
- Squirrel - query builder.
- xo - generate idiomatic Go code based on existing schema definitions or custom queries supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server.
- neo4j - Neo4j Rest API Bindings for Golang.
- Neo4j-GO - Neo4j REST Client for Golang.
- redigo - a Go client for the Redis database.
- beego orm - beego framework’s ORM support for go, including pq/mysql/sqlite3.
- go-pg - PostgreSQL ORM.
- go-queryset - type-safe ORM with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support based on GORM.
- go-sqlbuilder - a SQL string builder library plus a zero-config ORM.
- go-store - Redis backed key-value store library for Go.
- gomodel - Lightweight, fast, orm-like library helps interactive with database.
- GORM - a ORM library for Golang, aims to be developer friendly.
- Marlow - Generated ORM from project structs for compile time safety assurances.
- pop/soda - database migration, creation, ORM, and more. Supports MySQL, PostgreSQL, and SQLite.
- QBS - Query By Struct. A Go ORM.
- reform - ORM based on non-empty interfaces and code generation.
- SQLBoiler - ORM generator. Generate a ORM tailored to your database schema.
- upper.io/db - Single interface for interacting with different data sources through the use of adapters that wrap mature database drivers.
- Xorm - Simple and powerful ORM for Go.
- Zoom - Blazing-fast datastore and querying engine built on Redis.
-
Testing
- baloo - Expressive and versatile end-to-end HTTP API testing made easy.
- ginkgo - BDD Testing Framework for Go.
- goblin - Mocha like testing framework fo Go.
- gocheck - More advanced testing framework alternative to gotest.
- gotest - generate test from your source code.
- gofight - API Handler Testing for Golang Router framework.
-
REST
- frisby - REST API testing framework.
- httpexpect - Concise, declarative, and easy to use end-to-end HTTP and REST API testing.
- restit - Go micro framework to help writing RESTful API integration test.
- rclient - Readable, flexible, simple-to-use client for REST APIs
- resty - Simple HTTP and REST client for Go inspired by Ruby rest-client.
- sling - Go HTTP requests builder for API clients.
- go-rest - Small and evil REST framework for Go.
- Goat - Minimalistic REST API server in Go.
- REST Layer - Framework to build REST/GraphQL API on top of databases with mostly configuration over code.
- YARF - Fast micro-framework designed to build REST APIs and web services in a fast and simple way.
- ozzo-routing - An extremely fast Go (golang) HTTP router that supports regular expression route matching. Comes with full support for building RESTful APIs.
-
GraphQL
- graphql - graphql parser + utilities.
- graphql - implementation in go.
- graphql-go - GraphQL server with a focus on ease of use.
- jsonql - JSON query expression library in Golang.
-
Utilities
-
WebSockets
- Gorilla Websocket Toolkit - WebSocket implementation for Go.
- Websocket - Package Websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
- Ws - Tiny WebSocket library for Go.