Dockerfile

This commit is contained in:
Jan 2024-09-15 20:36:42 +02:00
parent 3b670426e5
commit 0a468ac9f4
3 changed files with 22 additions and 4 deletions

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# syntax=docker/dockerfile:1
FROM golang:1.23
WORKDIR /app
COPY go.mod ./
RUN go mod download
COPY . .
RUN go build -o /Mensa-API
EXPOSE 80
CMD [ "/Mensa-API" ]

View File

@ -17,7 +17,6 @@ func ScrapeState(h io.ReadCloser) []string {
doc.Find("a.primary").Each(func(i int, s *goquery.Selection) {
href, _ := s.Attr("href")
print(href)
city := strings.Split(href, "/")[0]

View File

@ -5,14 +5,16 @@ import (
)
func Run() {
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
"message": "Mensen API",
})
})
r.GET("/state/:state", state)
r.GET("/city/:city", city)
r.GET("/mensa/:city/:mensa", mensa)
r.Run() // listen and serve on
r.Run(":80")
}