paisa/internal/server/server.go

22 lines
454 B
Go
Raw Normal View History

2022-03-30 12:11:44 -04:00
package server
import (
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
2022-04-02 03:31:29 -04:00
"gorm.io/gorm"
2022-03-30 12:11:44 -04:00
)
2022-04-02 03:31:29 -04:00
func Listen(db *gorm.DB) {
2022-03-30 12:11:44 -04:00
gin.SetMode(gin.ReleaseMode)
router := gin.Default()
router.SetTrustedProxies(nil)
router.Static("/static", "web/static")
router.StaticFile("/", "web/static/index.html")
2022-04-02 03:31:29 -04:00
router.GET("/api/investment", func(c *gin.Context) {
c.JSON(200, GetInvestment(db))
})
log.Info("Listening on 7500")
router.Run(":7500")
2022-03-30 12:11:44 -04:00
}