VILLASweb-backend-go/start.go

56 lines
1.6 KiB
Go

package main
import (
"github.com/gin-gonic/gin"
"github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/common"
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/endpoints"
_ "git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/apidocs" // apidocs folder is generated by Swag CLI, you have to import it
)
// @title VILLASweb Backend API
// @version 2.0
// @description This is the API of the VILLASweb Backend
// @description WORK IN PROGRESS! PLEASE BE PATIENT!
// @description This documentation is auto-generated based on the API documentation in the code.
// @description The tool https://github.com/swaggo/swag is used to auto-generate API docs for gin.
// @contact.name Sonja Happ
// @contact.email sonja.happ@eonerc.rwth-aachen.de
// @license.name GNU GPL 3.0
// @license.url http://www.gnu.de/documents/gpl-3.0.en.html
// @host aaa.bbb.ccc.ddd:pppp
// @BasePath /api/v2
func main() {
// Testing
db := common.InitDB()
common.MigrateModels(db)
defer db.Close()
r := gin.Default()
api := r.Group("/api")
// use ginSwagger middleware to
endpoints.UsersRegister(api.Group("/users"))
//file.FilesRegister(api.Group("/files"))
//project.ProjectsRegister(api.Group("/projects"))
endpoints.SimulationsRegister(api.Group("/simulations"))
//model.ModelsRegister(api.Group("/simulations"))
endpoints.SimulatorsRegister(api.Group("/simulators"))
//visualization.VisualizationsRegister(api.Group("/visualizations"))
r.GET("swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.Run()
}