achanda / gorest

REST API in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic REST API in Go

Running locally (needs posgres running)

# set env vars
go run main.go

Create a new post

curl -H "Content-Type: application/json" -X POST -d '{"title": "Hello world", "text": "intro"}' http://127.0.0.1:3000/posts

Get version

curl http://127.0.0.1:3000/version

Get posts

curl http://127.0.0.1:3000/posts

Build

GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/achanda/gorest/version.Version=`git rev-parse HEAD`" -o gorest .

Generate image

docker build . -t gorest

About

REST API in Go

License:MIT License


Languages

Language:Go 91.6%Language:Smarty 8.4%