From 72fcb1a158e424552a130bed0b6f0c514fa7a536 Mon Sep 17 00:00:00 2001 From: Tobias Lindberg Date: Mon, 15 Feb 2021 14:25:58 +0100 Subject: [PATCH] adding root endpoint telling API is running --- src/webserver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/webserver.go b/src/webserver.go index 19a1d84..a2a8934 100644 --- a/src/webserver.go +++ b/src/webserver.go @@ -27,6 +27,13 @@ func main() { // kicking off Gin in value r r := gin.Default() + // root endpoint telling API is running + r.GET("/", func(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{ + "message": "API runnnig..", + }) + }) + // /cars endpoint r.GET("/cars", func(c *gin.Context) { // TeslaMateAPICars to get cars