app := iris.New()
app.Use(recover.New())
app.Use(logger.New())
crs := cors.New(cors.Options{
AllowedOrigins: []string{""}, //允许通过的主机名称
AllowCredentials: true,
AllowedMethods: []string{"HEAD", "GET", "POST", "PUT", "PATCH", "DELETE"},
AllowedHeaders: []string{""},
})
v1 := app.Party("/", crs).AllowMethods(iris.MethodOptions)
{
v1.Get("/AllBlocks", getallblocks)
}
app.Run(iris.Addr(":" + conf.Port))
网友评论