61 lines
1.2 KiB
Go
61 lines
1.2 KiB
Go
// App-Idea Rest-API Documentation
|
|
//
|
|
// Example Swagger spec.
|
|
//
|
|
// Schemes: [http, https]
|
|
// BasePath: /api/v1/
|
|
// Version: 0.0.1
|
|
// Contact: Alex<alex@roese.dev>
|
|
//
|
|
// Consumes:
|
|
// - application/json
|
|
//
|
|
// Produces:
|
|
// - application/json
|
|
//
|
|
// SecurityDefinitions:
|
|
// api_key:
|
|
// type: apiKey
|
|
// name: Authorization
|
|
// in: header
|
|
// swagger:meta
|
|
package main
|
|
|
|
import (
|
|
"git.umbach.dev/app-idea/rest-api/modules/config"
|
|
"git.umbach.dev/app-idea/rest-api/modules/database"
|
|
"git.umbach.dev/app-idea/rest-api/modules/serversettings"
|
|
"git.umbach.dev/app-idea/rest-api/routers/router"
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
"github.com/gofiber/fiber/v2"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func main() {
|
|
app := fiber.New()
|
|
|
|
config.LoadConfig()
|
|
|
|
cfg := config.GetConfig()
|
|
|
|
if cfg.Server.Debug {
|
|
log.SetLevel(log.DebugLevel)
|
|
}
|
|
|
|
router.SetupRoutes(app)
|
|
|
|
database.InitDatabase()
|
|
serversettings.LoadServerSettings()
|
|
|
|
app.Listen(cfg.Server.Host)
|
|
}
|
|
|
|
/*
|
|
|
|
swagger generate spec -o ./swagger.yaml
|
|
|
|
sudo docker run -p 80:8080 -e SWAGGER_JSON=/api.yaml -v ~/Documents/coding/go/rest-api/swagger.yaml:/api.yaml swaggerapi/swagger-ui
|
|
|
|
*/
|