2016-12-13 05:03:34 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-10-02 16:08:24 +03:00
|
|
|
"log"
|
|
|
|
|
2016-12-13 05:06:25 +03:00
|
|
|
"github.com/gin-contrib/static"
|
2017-03-11 05:47:16 +03:00
|
|
|
"github.com/gin-gonic/gin"
|
2016-12-13 05:03:34 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
r := gin.Default()
|
|
|
|
|
|
|
|
// if Allow DirectoryIndex
|
2021-10-02 16:08:24 +03:00
|
|
|
// r.Use(static.Serve("/", static.LocalFile("/tmp", true)))
|
2016-12-13 05:03:34 +03:00
|
|
|
// set prefix
|
2021-10-02 16:08:24 +03:00
|
|
|
// r.Use(static.Serve("/static", static.LocalFile("/tmp", true)))
|
2016-12-13 05:03:34 +03:00
|
|
|
|
|
|
|
r.Use(static.Serve("/", static.LocalFile("/tmp", false)))
|
|
|
|
r.GET("/ping", func(c *gin.Context) {
|
|
|
|
c.String(200, "test")
|
|
|
|
})
|
|
|
|
// Listen and Server in 0.0.0.0:8080
|
2021-10-02 16:08:24 +03:00
|
|
|
if err := r.Run(":8080"); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2016-12-13 05:03:34 +03:00
|
|
|
}
|