+
+
+
+
+
+
diff --git a/pkg/api/README.md b/pkg/api/README.md
index dede893..729c649 100644
--- a/pkg/api/README.md
+++ b/pkg/api/README.md
@@ -1,8 +1,23 @@
-# A list of API calls
+# Working API Calls
-```
+```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
```
-
diff --git a/pkg/api/api_handler.go b/pkg/api/api_handler.go
index 0d09820..f969709 100644
--- a/pkg/api/api_handler.go
+++ b/pkg/api/api_handler.go
@@ -14,9 +14,9 @@ func HandleAPI(path string, res http.ResponseWriter, req *http.Request) (bool, b
suspectApi := strings.ToLower(splitUrl[len(splitUrl)-1])
switch suspectApi {
- case "authentication":
+ case "user_auth":
return true, UserAuthentication(res, req)
- case "registration":
+ case "user_register":
return true, UserRegistration(res, req)
default:
return false, false
diff --git a/pkg/api/user.go b/pkg/api/user.go
index 74ef509..760eae9 100644
--- a/pkg/api/user.go
+++ b/pkg/api/user.go
@@ -23,7 +23,8 @@ var userDatabaseData struct {
}
// UserAuthentication function is accessed by an API call from the webhost root
-// by accessing /authentication and sending it a post request with
+// by accessing /user_auth and sending it a post request with userRequestData
+// struct in JSON format.
func UserAuthentication(res http.ResponseWriter, req *http.Request) bool {
if req.Method != "POST" {
http.Error(res, req.Method+" HTTP method is unsupported for this API.", http.StatusMethodNotAllowed)
@@ -60,8 +61,9 @@ func UserAuthentication(res http.ResponseWriter, req *http.Request) bool {
return true
}
-// UserAuthentication function is accessed by an API call from the webhost root
-// by accessing /authentication and sending it a post request with
+// UserRegistration function is accessed by an API call from the webhost root
+// by accessing /user_register and sending it a post request with userRequestData
+// struct in JSON format.
func UserRegistration(res http.ResponseWriter, req *http.Request) bool {
if req.Method != "POST" {
http.Error(res, req.Method+" HTTP method is unsupported for this API.", http.StatusMethodNotAllowed)