personal-website/main.go

38 lines
771 B
Go
Raw Normal View History

2023-03-15 00:05:24 +00:00
package main
import (
"log"
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.New()
// router.Use(rateLimit, gin.Recovery())
router.LoadHTMLGlob("resources/*.html")
// router.Static("/static", "resources/static")
router.Static("/res", "resources")
router.GET("/", index)
router.GET("/getmockapp", func(ctx *gin.Context) {
ctx.HTML(http.StatusOK, "mockapp.html", nil)
})
// router.GET("/room/:roomid", roomGET)
// router.POST("/room-post/:roomid", roomPOST)
// router.GET("/stream/:roomid", streamRoom)
// port := os.Getenv("PORT")
// if port == "" {
// port = "8080"
// }
if err := router.Run(":8080"); err != nil {
log.Panicf("error: %s", err)
}
}
func index(c *gin.Context) {
c.HTML(http.StatusOK, "base.html", nil)
}