You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
642 B
Go
29 lines
642 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"code.locsi.com/locsi/api/models"
|
|
"code.locsi.com/locsi/websub/controllers"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func main() {
|
|
log.Print("in main")
|
|
// env := os.Getenv("ENV")
|
|
|
|
r := gin.Default()
|
|
|
|
// WebSub Routes
|
|
// Connecting to the database here instead of in each task so we can just maintain one connection. Otherwise we could flood the db with connections and block other users.
|
|
models.ConnectDatabase()
|
|
|
|
r.GET("/sub/callback/:id", controllers.GetSubCallback)
|
|
r.POST("/sub/callback/:id", controllers.PostSubCallback)
|
|
|
|
// Health check route
|
|
r.GET("/health", controllers.GetHealth)
|
|
|
|
r.Run(":8082")
|
|
}
|