RESTful API with go and postgres
-
Set up a postgres database, create table like users.sql
-
Change the username, password, database and port in main.go
-
Get the 3rd party libraries/framework
$ go get github.com/lib/pq
$ go get github.com/gorilla/mux
$ go build
$ ./go-rest
http://localhost:<port>/user/:id
$ curl -XPOST -H 'Content-Type: application/json' -d '{"name": "Bob Smith", "age": 50}' http://localhost:<port>/user