move webserver files to ./web/
This commit is contained in:
@@ -21,8 +21,8 @@ RUN go mod download
|
||||
|
||||
# Copy the source code
|
||||
COPY ./src/cmd ./cmd
|
||||
COPY ./src/assets ./assets
|
||||
COPY ./src/internal ./internal
|
||||
COPY ./src/web ./web
|
||||
|
||||
# Build the application
|
||||
RUN go build -o main cmd/frontend/*
|
||||
@@ -36,9 +36,9 @@ WORKDIR /app
|
||||
# Copy the built binary from the builder stage
|
||||
COPY --from=builder /app/main .
|
||||
COPY --from=builder /goose.git/goose .
|
||||
COPY ./src/assets ./assets
|
||||
COPY ./src/migrations ./migrations
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# Command to run the application
|
||||
CMD ["sh", "-c", "/app/goose -dir=/app/assets/migrations/ postgres postgresql://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME up && /app/main"]
|
||||
CMD ["sh", "-c", "/app/goose -dir=/app/migrations/ postgres postgresql://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME up && /app/main"]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crowsnest/internal/app"
|
||||
"crowsnest/internal/crawler"
|
||||
"crowsnest/internal/middleware"
|
||||
"crowsnest/internal/model"
|
||||
"crowsnest/internal/model/database"
|
||||
"crowsnest/internal/util"
|
||||
"crowsnest/web/app"
|
||||
"crowsnest/web/middleware"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"crowsnest/internal/html"
|
||||
"crowsnest/web/html"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"crowsnest/internal/html"
|
||||
"crowsnest/web/html"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
@@ -37,6 +37,6 @@ func (app *App) Index(w http.ResponseWriter, req *http.Request) {
|
||||
err = html.IndexLayout(articleVMs, uint(pageId+1), totalCount+1).Render(w)
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to render template", http.StatusInternalServerError)
|
||||
return
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"crowsnest/internal/html"
|
||||
"crowsnest/web/html"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -27,6 +27,6 @@ func (app *App) UpSearch(w http.ResponseWriter, req *http.Request) {
|
||||
err = html.IndexLayout(articleVMs, 0, 0).Render(w)
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to render template", http.StatusInternalServerError)
|
||||
return
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user