-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
31 lines (28 loc) · 999 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
_ "github.com/ACMUD/modulo-inscripciones_crud/routers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/astaxie/beego/plugins/cors"
_ "github.com/lib/pq"
)
func main() {
orm.RegisterDataBase("default", "postgres", "postgres://"+beego.AppConfig.String("UserDB")+":"+beego.AppConfig.String("PassDB")+"@"+beego.AppConfig.String("Urls")+"/"+beego.AppConfig.String("DB")+"?sslmode=disable")
if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true
beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
}
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowOrigins: []string{"*"},
AllowMethods: []string{"PUT", "PATCH", "GET", "POST", "OPTIONS", "DELETE"},
AllowHeaders: []string{"Origin", "x-requested-with",
"content-type",
"accept",
"origin",
"authorization",
"x-csrftoken"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
}))
beego.Run()
}