mirror of
https://github.com/LeRoid-hub/Mensa-API.git
synced 2025-01-31 03:34:57 +00:00
Dockerfile
This commit is contained in:
parent
3b670426e5
commit
0a468ac9f4
17
Dockerfile
Normal file
17
Dockerfile
Normal 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" ]
|
@ -17,7 +17,6 @@ func ScrapeState(h io.ReadCloser) []string {
|
|||||||
|
|
||||||
doc.Find("a.primary").Each(func(i int, s *goquery.Selection) {
|
doc.Find("a.primary").Each(func(i int, s *goquery.Selection) {
|
||||||
href, _ := s.Attr("href")
|
href, _ := s.Attr("href")
|
||||||
print(href)
|
|
||||||
|
|
||||||
city := strings.Split(href, "/")[0]
|
city := strings.Split(href, "/")[0]
|
||||||
|
|
||||||
|
@ -5,14 +5,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
|
gin.SetMode(gin.ReleaseMode)
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.GET("/ping", func(c *gin.Context) {
|
|
||||||
|
r.GET("/", func(c *gin.Context) {
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"message": "pong",
|
"message": "Mensen API",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
r.GET("/state/:state", state)
|
r.GET("/state/:state", state)
|
||||||
r.GET("/city/:city", city)
|
r.GET("/city/:city", city)
|
||||||
r.GET("/mensa/:city/:mensa", mensa)
|
r.GET("/mensa/:city/:mensa", mensa)
|
||||||
r.Run() // listen and serve on
|
r.Run(":80")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user