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

setting up main, go.mod, handler and structs

parent d4c50de2
No related branches found
No related tags found
No related merge requests found
package main
import (
"assignment2"
"fmt"
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.HandleFunc("/", assignment2.HandlerNil)
http.HandleFunc("/repocheck/v1/commits", assignment2.HandlerCommits) // runs handelr function
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
fmt.Println("Listening on port " + port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}
\ No newline at end of file
module assignment2
go 1.13
package assignment2
import (
"net/http"
"fmt"
)
func HandlerNil(w http.ResponseWriter, r *http.Request) { //standar default respons
fmt.Println("Default Handler: Invalid request received.")
http.Error(w, "Invalid request", http.StatusBadRequest)
}
func HandlerCommits (w http.ResponseWriter, r *http.Request) {
}
func HandlerLanguages (w http.ResponseWriter, r *http.Request) {
}
func HandlerIssues (w http.ResponseWriter, r *http.Request) {
}
func HandlerStatus (w http.ResponseWriter, r *http.Request) {
}
package assignment2
import (
)
\ 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