31 lines
501 B
Go
Raw Normal View History

package main
import (
2022-12-27 23:53:28 -05:00
"anonymousoverflow/src/middleware"
"anonymousoverflow/src/routes"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.LoadHTMLGlob("templates/*")
r.Static("/static", "./public")
2022-12-27 23:53:28 -05:00
r.Use(middleware.OptionsMiddleware())
r.GET("/robots.txt", func(c *gin.Context) {
c.String(200, "User-agent: *\nDisallow: /")
})
2022-12-27 23:53:28 -05:00
r.GET("/", routes.GetHome)
2022-12-27 23:53:28 -05:00
r.POST("/", routes.PostHome)
2022-12-27 22:46:31 -05:00
2022-12-27 23:53:28 -05:00
r.GET("/questions/:id/:title", routes.ViewQuestion)
2022-12-27 22:46:31 -05:00
r.Run("localhost:8080")
}