57 lines
1.1 KiB
Go
57 lines
1.1 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/routers/config"
|
|
"git.umbach.dev/app-idea/rest-api/routers/database"
|
|
"git.umbach.dev/app-idea/rest-api/routers/router"
|
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
"github.com/gofiber/fiber/v2"
|
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
|
)
|
|
|
|
func main() {
|
|
app := fiber.New()
|
|
|
|
app.Use(cors.New(cors.Config{
|
|
AllowOrigins: "*",
|
|
AllowHeaders: "Origin, Content-Type, Accept",
|
|
}))
|
|
|
|
router.SetupRoutes(app)
|
|
|
|
config.LoadConfig()
|
|
database.InitDatabase()
|
|
|
|
app.Listen(config.GetConfig().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
|
|
|
|
*/
|