Skip to content
Snippets Groups Projects
Commit 27e1fc7c authored by Hans Kristian Hoel's avatar Hans Kristian Hoel
Browse files

setting up some structs and starting on handlers

parent be1b9ee3
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ func main() {
http.HandleFunc("/repocheck/v1/languages", assignment2.HandlerLanguages) // runs handelr function
http.HandleFunc("/repocheck/v1/issues", assignment2.HandlerIssues) // runs handelr function
http.HandleFunc("/repocheck/v1/status", assignment2.HandlerStatus) // runs handelr function
http.HandleFunc("/repocheck/v1/webhooks", assignment2.HandlerWebhooks) // runs handelr function
fmt.Println("Listening on port " + port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}
\ No newline at end of file
......@@ -12,17 +12,50 @@ func HandlerNil(w http.ResponseWriter, r *http.Request) { //standar default res
func HandlerCommits (w http.ResponseWriter, r *http.Request) {
limit := r.URL.Query().Get("limit") // Reads limit
if limit == "" { // cheks if there exist an limit
limit = "5" // sets limit to 5
}
auth := r.URL.Query().Get("auth") // Reads auth
if auth == "" { // cheks if there exist an auth
auth = "false" // sets auth to false
}
}
func HandlerLanguages (w http.ResponseWriter, r *http.Request) {
limit := r.URL.Query().Get("limit") // Reads limit
if limit == "" { // cheks if there exist an limit
limit = "5" // sets limit to 5
}
auth := r.URL.Query().Get("auth") // Reads auth
if auth == "" { // cheks if there exist an auth
auth = "false" // sets auth to false
}
}
func HandlerIssues (w http.ResponseWriter, r *http.Request) {
types := r.URL.Query().Get("type")
if types == "" {
// error
}
auth := r.URL.Query().Get("auth") // Reads auth
if auth == "" { // cheks if there exist an auth
auth = "false" // sets auth to false
}
}
func HandlerStatus (w http.ResponseWriter, r *http.Request) {
}
func HandlerWebhooks (w http.ResponseWriter, r *http.Request) {
}
\ No newline at end of file
......@@ -3,3 +3,15 @@ package assignment2
import (
)
type Language struct {
Languages []string `json:"lagnguages"`
Auth string `json:"auth2`
}
type Status struct {
Gitlab int `json:"gitlab"`
Database int `json:"database"`
Uptime int `json:"uptime"`
Version string `json:"version"`
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment