Skip to content

bigUNO/golang_api_skel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang_api_skel

Build Status Basic framework for Go API

Build

Creates an executable called api in the build directory.

go build -o build/golang_api_skel src/*

Docker

Designed to run inside a docker container.

Docker healthchecks curl /healthcheck to see if app is alive.

Testing

Use docker to test

docker build -t golang_api_skel .
docker run -d --publish 6060:8080 --name test --rm golang_api_skel

Test the healthcheck

curl http://localhost:6060/healthcheck

Clean up

docker stop test

Usage

Return {"alive": true. Great for testing. Note that the healthcheck is not versioned.

curl http://localhost:8080/healthcheck

Return all items

curl http://localhost:8080/v0/items

Return single item

curl http://localhost:8080/v0/items/b379fdbaqj868olu1gi0

Note the example above will not work, you need to grab the UUID of one of the test items.

Add item

curl -H "Content-Type: application/json" -d '{"name":"soda"}' http://localhost:8080/v0/items

Want to contribute?

You can create a GitHub issue for any feature requests, bugs, or documentation improvements.

Where possible, please submit a pull request for the change.

About

Basic framework for Go API

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published