From d33bc74ca62e0aaebebd66fe4be43a561210ad80 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 20 Sep 2019 10:11:14 +0700 Subject: http: update the package documentation --- lib/http/http.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. -- cgit v1.3