34 lines
602 B
Go
34 lines
602 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"zomo.dev/largehadroncollider/db"
|
|
"zomo.dev/largehadroncollider/ttv"
|
|
"zomo.dev/largehadroncollider/util"
|
|
)
|
|
|
|
func InitApiServer(conf *util.Config, dbConn *db.DBConn, twitchConn *ttv.TwitchConn) (*ApiServer, error) {
|
|
engine := gin.Default()
|
|
|
|
apiServer := &ApiServer{ engine, conf, dbConn, twitchConn }
|
|
|
|
apiServer.loadEndpoints()
|
|
|
|
return apiServer, nil
|
|
}
|
|
|
|
type ApiServer struct {
|
|
engine *gin.Engine
|
|
conf *util.Config
|
|
db *db.DBConn
|
|
twitch *ttv.TwitchConn
|
|
}
|
|
|
|
func (server *ApiServer) Listen() {
|
|
server.engine.Run()
|
|
}
|
|
|
|
func initHTMLFiles() {
|
|
|
|
}
|