Skip to content

The Gopher API, is a simple CRUD API for formative purpose, we're building it while writing the posts of the blog.

License

Notifications You must be signed in to change notification settings

friendsofgo/gopherapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Gopher API

The Gopher API, is a evolutive simple CRUD API for formative purpose, we're building it while writing the posts of the blog.

In this API we've learnt differents, features and patterns in Go:

  • Using Gorilla Mux to create an simple API
  • Using a SOLID, Hexagonal Architecture
  • Testing HTTP handlers
  • Integration with CircleCI
  • Using Wire to build dependencies only in v0.3.1
  • Using pattern contextkey
  • Using instrumenting with Zipkin

How can I use it?

Install

$ go get -u github.com/friendsofgo/gopherapi/cmd/gopherapi

Usage Launch server with predefined data

$ gopherapi --withData
The gopher server is on tap now: http://localhost:8080

If you want to start the server using zipkin you will need use the next option

$ gopherapi --withTrace

If you want start the server using cockroachdb you will need use the next option

$gopherapi --cockroach

Endpoints

Fetch all gophers

GET /gophers

Fetch a gopher by ID

GET /gophers/{gopher_id}

Add a gopher

POST /gophers

Modify a gopher

PUT /gophers/{gopher_id}

Remove a gopher

DELETE /gophers/{gopher_id}

You can import the Postman collection into api/GopherApi.postman_collection

Launch Zipkin

docker run -d -p 9411:9411 openzipkin/zipkin

Contributing

If you think that you can improve with new endpoints, and functionallities the API feel free to contribute with this project with fork this repo and send your Pull Request.

License

MIT License, see LICENSE

About

The Gopher API, is a simple CRUD API for formative purpose, we're building it while writing the posts of the blog.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages