Initial commit with sample app

This commit is contained in:
sid palas
2023-01-23 10:48:02 -05:00
commit 22ad01e315
29 changed files with 2231 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package main
import (
"log"
"os"
"github.com/gin-gonic/gin"
"api-golang/database"
)
func init() {
errDB := database.InitDB(os.Getenv("DATABASE_URL"))
if errDB != nil {
log.Fatalf("⛔ Unable to connect to database: %v\n", errDB)
} else {
log.Println("DATABASE CONNECTED 🥇")
}
}
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
database.GetTime(c)
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080
}