referencing issue #59

This commit is contained in:
George Shaw 2017-11-06 11:54:12 -06:00
parent 08b94c3a4c
commit ddbdbabe48
4 changed files with 47 additions and 28 deletions

View file

@ -1,23 +1,3 @@
# Working API Calls
# API Documentation
```go
// User Authentication API - pkg/api/user_auth.go
/*
JSON Data Required:
{
"user": "test",
"pass": "test",
}
*/
func UserAuthentication(res http.ResponseWriter, req *http.Request) bool
// User Registration API - pkg/api/user_auth.go
/*
JSON Data Required:
{
"user": "test",
"pass": "test",
}
*/
func UserRegistration(res http.ResponseWriter, req *http.Request) bool
```
Navigate inside of the folders of this package to see specific documentation on the various available APIs.

View file

@ -16,11 +16,11 @@ func HandleAPI(path string, res http.ResponseWriter, req *http.Request) (bool, b
suspectApi := strings.ToLower(splitUrl[len(splitUrl)-1])
switch suspectApi {
case "user_auth":
case "api/user/auth":
return true, user.Auth(res, req)
case "user_register":
case "api/user/register":
return true, user.Register(res, req)
case "user_logout":
case "api/user/logout":
return true, user.Logout(res, req)
default:
return false, false

39
pkg/api/user/README.md Normal file
View file

@ -0,0 +1,39 @@
# User API Documentation
```go
/*
Relative API Path:
api/user/auth
Request:
{
"user": "test",
"pass": "test",
}
Response(204, 400, 401, 405, 500):
N/A
*/
func UserAuthentication(res http.ResponseWriter, req *http.Request) bool
/*
Relative API Path:
api/user/register
Request:
{
"user": "test",
"pass": "test",
}
Response (204, 400, 405, 500):
N/A
*/
func UserRegistration(res http.ResponseWriter, req *http.Request) bool
/*
Relative API Path:
api/user/logout
Request:
N/A
Response (204, 405, 500):
N/A
*/
func UserLogout(res http.ResponseWriter, req *http.Request) bool
```

View file

@ -23,9 +23,9 @@ func reqAuth(path string) bool {
dismissibleFiles := []string{
"index.html",
"user_auth",
"user_register",
"user_logout",
"api/user/auth",
"api/user/register",
"api/user/logout",
}
for _, f := range dismissibleFiles {
if strings.HasSuffix(path, f) {