Add basic /status endpoint
Also add test for this endpoint
This commit is contained in:
parent
5377e42e71
commit
4a0a91a1f1
3 changed files with 57 additions and 9 deletions
12
main.go
12
main.go
|
@ -1,23 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func main() {
|
||||
router := mux.NewRouter().StrictSlash(true)
|
||||
|
||||
router.HandleFunc("/", HandleRoot)
|
||||
// Create a new router
|
||||
router := NewRouter()
|
||||
|
||||
// Listen and serve the http requests
|
||||
if err := http.ListenAndServe(":8080", router); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func HandleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello World")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue