feat(backend): env added
This commit is contained in:
@@ -15,6 +15,7 @@ require (
|
|||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
|
github.com/joho/godotenv v1.5.1 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
|
|||||||
@@ -2,22 +2,32 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
err := godotenv.Load("../.env")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Error loading .env file")
|
||||||
|
}
|
||||||
|
|
||||||
|
// name := os.Getenv("LSTV2")
|
||||||
|
|
||||||
|
// fmt.Println(name)
|
||||||
fmt.Println("Welcome to lst backend where all the fun happens.")
|
fmt.Println("Welcome to lst backend where all the fun happens.")
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
|
||||||
// Serve Docusaurus static files
|
// Serve Docusaurus static files
|
||||||
r.StaticFS("/lst/docs", http.Dir("docs"))
|
r.StaticFS("/lst/docs", http.Dir("docs"))
|
||||||
|
|
||||||
|
|
||||||
r.GET("/api/ping", func(c *gin.Context) {
|
r.GET("/api/ping", func(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{"message": "pong"})
|
c.JSON(200, gin.H{"message": "pong"})
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Any("/api", errorApiLoc)
|
r.Any("/api", errorApiLoc)
|
||||||
r.Any("/", errorLoc)
|
r.Any("/", errorLoc)
|
||||||
|
|||||||
Reference in New Issue
Block a user