Closed
Description
hi,
func main() {
router := gin.Default()
router.GET("/", func(c *gin.Context) {
....
})
router.Run(":8080") // data services
routerAdmin := gin.Default()
routerAdmin.GET("/", func(c *gin.Context) {
.....
})
routerAdmin.Run(":8090") // admin and monitor services
}
but , only one port ( 8080 port ) working
yet, i know there some others solution to split different URL rout for two propose.
i just want to know single program can service tow port or not.
some one help for this??
thanks a lot.
Activity
JimmyPettersson85 commentedon Jun 22, 2015
gin.Run()
is blocking so you have to call them in separate goroutines if you want to accomplish that.manucorporat commentedon Jul 5, 2015
@tsingson @Slimmy is right.
tsingson commentedon Jul 5, 2015
@Slimmy @manucorporat thanks a lot!!
shen-xianpeng commentedon Aug 1, 2016
you can do it like this:
go func() { router1.Run("127.0.0.1:9000") }()
router2.Run("127.0.0.1:8000")
eubyte commentedon Dec 16, 2016
Is there support for multiple sites/vhosts?
appleboy commentedon Sep 28, 2017
See the PR #1119 and the following example:
feiyuchuixue commentedon Oct 8, 2018
Hi, Run multiple service using Gin can use https ? I want create a http and https multiple service
kai-zer-ru commentedon Aug 20, 2019
Hi! How to use graceful shutdown with multiple servers?
cdyue commentedon Feb 19, 2021
any update?
appleboy commentedon Feb 21, 2021
What is the scenario on graceful shutdown with multiple servers?
KnBrBz commentedon Aug 6, 2021
Can this considered graceful? Not full code, but main idea is shown
For now using this only in tests.