mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	默认允许跨域请求API
This commit is contained in:
		@@ -49,11 +49,8 @@ func NewServer(appConfig *types.AppConfig) *AppServer {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *AppServer) Init(debug bool, client *redis.Client) {
 | 
			
		||||
	if debug { // 调试模式允许跨域请求 API
 | 
			
		||||
		s.Debug = debug
 | 
			
		||||
		s.Engine.Use(corsMiddleware())
 | 
			
		||||
		logger.Info("Enabled debug mode")
 | 
			
		||||
	}
 | 
			
		||||
	// 允许跨域请求 API
 | 
			
		||||
	s.Engine.Use(corsMiddleware())
 | 
			
		||||
	s.Engine.Use(staticResourceMiddleware())
 | 
			
		||||
	s.Engine.Use(authorizeMiddleware(s, client))
 | 
			
		||||
	s.Engine.Use(parameterHandlerMiddleware())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user