23 lines
410 B
Go
23 lines
410 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
func SetupServer(db *sqlx.DB) *gin.Engine {
|
|
server := createServer()
|
|
LoadTemplates(server)
|
|
RegisterRoutes(server, db)
|
|
return server
|
|
}
|
|
|
|
func createServer() *gin.Engine {
|
|
server := gin.New()
|
|
server.NoRoute(NoRoute())
|
|
server.NoMethod(NoMethod())
|
|
server.Use(gin.Recovery())
|
|
server.Static("assets", "assets")
|
|
return server
|
|
}
|