# README
Examples for go-json-rest
Go-Json-Rest is a thin layer on top of net/http
that helps building RESTful JSON APIs easily.
See the Github repo here: https://github.com/ant0ine/go-json-rest
Copyright (c) 2013-2014 Antoine Imbert
# Packages
Demonstrate how to setup AuthBasicMiddleware as a pre-routing middleware.
Demonstrate how to implement a custom AuthBasic middleware, used to protect all endpoints.
Demonstrate how to setup CorsMiddleware around all the API endpoints.
Demonstrate how to implement a custom CORS middleware, used to on all endpoints.
Demonstrate simple POST GET and DELETE operations
The curl demo:
curl -i -d '{"Code":"FR","Name":"France"}' http://127.0.0.1:8080/countries
curl -i -d '{"Code":"US","Name":"United States"}' http://127.0.0.1:8080/countries
curl -i http://127.0.0.1:8080/countries/FR
curl -i http://127.0.0.1:8080/countries/US
curl -i http://127.0.0.1:8080/countries
curl -i -X DELETE http://127.0.0.1:8080/countries/FR
curl -i http://127.0.0.1:8080/countries
curl -i -X DELETE http://127.0.0.1:8080/countries/US
curl -i http://127.0.0.1:8080/countries
*/.
No description provided by the author
Demonstrate basic CRUD operation using a store based on MySQL and GORM
GORM (https://github.com/jinzhu/gorm) is simple ORM library.
Tradition!
The curl demo:
curl -i http://127.0.0.1:8080/message
*/.
Demonstrate how to use SPDY with https://github.com/shykes/spdy-go
For a command line client, install spdycat from:
https://github.com/tatsuhiro-t/spdylay
The spdycat demo:
spdycat -v --no-tls -2 http://localhost:8080/users/0
*/.
Demonstrate how to setup a /.status endpoint
Inspired by memcached "stats", this optional feature can be enabled to help monitoring the service.
Demonstrate how to setup a /.status endpoint protected with basic authentication.
Demonstrate a streaming REST API, where the data is "flushed" to the client ASAP.
Demonstrate how to use rest.RouteObjectMethod
rest.RouteObjectMethod helps create a Route that points to
an object method instead of just a function.