forked from AlexanderChen1989/go-json-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
47 lines (47 loc) · 1.37 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Package rest A quick and easy way to setup a RESTful JSON API
//
// http://ant0ine.github.io/go-json-rest/
//
// Go-JSON-Rest is a thin layer on top of net/http that helps building RESTful JSON APIs easily.
// It provides fast and scalable request routing using a Trie based implementation, helpers to deal
// with JSON requests and responses, and middlewares for functionalities like CORS, Auth, Gzip,
// Status, ...
//
// Example:
//
// package main
//
// import (
// "github.com/ant0ine/go-json-rest/rest"
// "log"
// "net/http"
// )
//
// type User struct {
// Id string
// Name string
// }
//
// func GetUser(w rest.ResponseWriter, req *rest.Request) {
// user := User{
// Id: req.PathParam("id"),
// Name: "Antoine",
// }
// w.WriteJSON(&user)
// }
//
// func main() {
// api := rest.NewAPI()
// api.Use(rest.DefaultDevStack...)
// router, err := rest.MakeRouter(
// rest.Get("/users/:id", GetUser),
// )
// if err != nil {
// log.Fatal(err)
// }
// api.SetApp(router)
// log.Fatal(http.ListenAndServe(":8080", api.MakeHandler()))
// }
//
//
package rest