photoprism/server/server.go
2018-07-20 14:13:52 +02:00

30 lines
485 B
Go

package server
import (
"github.com/gin-gonic/gin"
"fmt"
"net/http"
)
func Start(address string, port int) {
router := gin.Default()
router.LoadHTMLGlob("templates/*")
router.Static("/assets", "./assets")
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"title": "PhotoPrism",
})
})
router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
router.Run(fmt.Sprintf("%s:%d", address, port))
}