mirror of
https://github.com/pushbits/server.git
synced 2025-06-03 03:02:14 +02:00
Add configuration for HTTP and debug mode
This commit is contained in:
parent
ba0306f384
commit
354ce0c08d
4 changed files with 22 additions and 5 deletions
|
@ -13,9 +13,13 @@ import (
|
|||
)
|
||||
|
||||
// Create a Gin engine and setup all routes.
|
||||
func Create(db *database.Database, dp *dispatcher.Dispatcher) *gin.Engine {
|
||||
func Create(debug bool, db *database.Database, dp *dispatcher.Dispatcher) *gin.Engine {
|
||||
log.Println("Setting up HTTP routes.")
|
||||
|
||||
if !debug {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
}
|
||||
|
||||
auth := authentication.Authenticator{DB: db}
|
||||
|
||||
applicationHandler := api.ApplicationHandler{DB: db, Dispatcher: dp}
|
||||
|
@ -23,6 +27,7 @@ func Create(db *database.Database, dp *dispatcher.Dispatcher) *gin.Engine {
|
|||
userHandler := api.UserHandler{DB: db, Dispatcher: dp}
|
||||
|
||||
r := gin.Default()
|
||||
|
||||
r.Use(location.Default())
|
||||
|
||||
applicationGroup := r.Group("/application")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue