Commit a6b95a8c by xuzhenhao

修改了路由的中间件

1 parent afcdd599
Showing with 3 additions and 1 deletions
...@@ -11,7 +11,9 @@ import ( ...@@ -11,7 +11,9 @@ import (
func initRouter() *gin.Engine { func initRouter() *gin.Engine {
router := gin.Default() router := gin.Default()
router.Use(cors.Default()) config := cors.DefaultConfig()
config.AllowOrigins = []string{"http://127.0.0.1:8000"}
router.Use(cors.New(config))
router.POST("user/login", UserLoginApi) router.POST("user/login", UserLoginApi)
router.POST("user/register", UserRegisterApi) router.POST("user/register", UserRegisterApi)
router.POST("user/checkusername", CheckUserNameRepeatApi) router.POST("user/checkusername", CheckUserNameRepeatApi)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!