update
This commit is contained in:
		
							parent
							
								
									d071a26131
								
							
						
					
					
						commit
						fdfae04892
					
				
							
								
								
									
										13
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"git.trj.tw/golang/go-gallery/modules/routes"
 | 
			
		||||
	"github.com/gin-gonic/gin"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var server *gin.Engine
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	server = routes.NewServ()
 | 
			
		||||
	server.Run(":10230")
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								modules/routes/routes.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								modules/routes/routes.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
package routes
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/gin-gonic/gin"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// NewServ - get new service
 | 
			
		||||
func NewServ() *gin.Engine {
 | 
			
		||||
	r := gin.Default()
 | 
			
		||||
	return r
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetDefaultRoutes - set default
 | 
			
		||||
func SetDefaultRoutes(r *gin.Engine) {
 | 
			
		||||
	r.GET("/", func(c *gin.Context) {
 | 
			
		||||
		c.JSON(200, gin.H{
 | 
			
		||||
			"message": "test",
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user