diff options
| author | Shulhan <m.shulhan@gmail.com> | 2019-09-20 10:11:14 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2019-09-23 23:47:48 +0700 |
| commit | d33bc74ca62e0aaebebd66fe4be43a561210ad80 (patch) | |
| tree | a41b57e1572a665ab0ee4abbdfb3b3d56aec180e | |
| parent | b94d65f550dc3e95839579d42b968685d4ee890f (diff) | |
| download | pakakeh.go-d33bc74ca62e0aaebebd66fe4be43a561210ad80.tar.xz | |
http: update the package documentation
| -rw-r--r-- | lib/http/http.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/http/http.go b/lib/http/http.go index 307505e4..4376e324 100644 --- a/lib/http/http.go +++ b/lib/http/http.go @@ -63,6 +63,12 @@ // User just need to focus on step 3, handling on how to process request, all // of process on step 1, 2, and 4 will be handled by our library. // +// import ( +// libhttp "github.com/shuLhan/share/lib/http" +// ) +// +// ... +// // epAPILogin := &libhttp.Endpoint{ // Path: "/api/login", // RequestType: libhttp.RequestTypeQuery, @@ -71,11 +77,15 @@ // } // server.RegisterPost(epAPILogin) // +// ... +// // Upon receiving request to "/api/login", the library will call // "req.ParseForm()", read the content of body and pass them to // "handleLogin", // -// func handleLogin(req *http.Request, reqBody []byte) (resBody []byte, err error) { +// func handleLogin(res http.ResponseWriter, req *http.Request, reqBody []byte) ( +// resBody []byte, err error, +// ) { // // Process login input from req.Form, req.PostForm, and/or // // reqBody. // // Return response body and error. |
