-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
65 lines (51 loc) · 1.37 KB
/
Copy pathmain.go
File metadata and controls
65 lines (51 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"check/config"
"check/router"
"fmt"
"net/http"
"os"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)
func main() {
r := gin.Default()
LoadEnv()
// Serve the HTML page
r.LoadHTMLGlob("templates/*")
// Optional: serve static files if you want to access uploads
r.Static("/static", "./static")
// Main route for the upload page
r.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", nil)
})
r.GET("/home", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", nil)
})
r.GET("/about", func(c *gin.Context) {
c.HTML(http.StatusOK, "about.html", nil)
})
r.GET("/upload", func (c *gin.Context) {
c.HTML(http.StatusOK, "upload_in_progress.html", nil)
})
// Upload endpoint
r.POST("/upload", router.HandleUpload)
r.POST("/save", router.HandleSave)
// Run the server
fmt.Println("🚀 Running server")
r.Run(":8080")
}
func LoadEnv() {
_ = godotenv.Load()
config.EnvVars = config.EnvVariables{
VeryfiAPIKEY: os.Getenv("VeryfiAPI_KEY"),
VeryfiAPIUsername: os.Getenv("VeryfiAPI_USERNAME"),
VeryfiClientID: os.Getenv("VeryfiClientID"),
VeryfiURL: os.Getenv("VeryfiURL"),
DBHost: os.Getenv("DBHost"),
DBUsername: os.Getenv("DBUsername"),
DBPassword: os.Getenv("DBPassword"),
DBPort: os.Getenv("DBPort"),
DBName: os.Getenv("DBName"),
}
}