Made generating static site possible
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8aaecbab69
commit
029b426757
3
Makefile
3
Makefile
|
@ -4,14 +4,17 @@ APIURL_staging := https://api.quenten.nl/api/testing
|
|||
build:
|
||||
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
|
||||
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
|
||||
cp -r web staticsite/
|
||||
|
||||
build-new:
|
||||
GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
|
||||
go build -o app ./src
|
||||
cp -r web staticsite/
|
||||
|
||||
build-prod:
|
||||
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
|
||||
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
|
||||
cp -r web staticsite/
|
||||
|
||||
run: build
|
||||
./app
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"compress/gzip"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/maxence-charriere/go-app/v9/pkg/app"
|
||||
|
@ -89,6 +90,9 @@ func main() {
|
|||
app.GenerateStaticWebsite("./staticsite", handler)
|
||||
compressed := handlers.CompressHandlerLevel(handler, gzip.BestSpeed)
|
||||
http.Handle("/", compressed)
|
||||
if os.Getenv("GEN_STATIC_SITE") == "true" {
|
||||
return
|
||||
}
|
||||
|
||||
if err := http.ListenAndServe(":8000", nil); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in New Issue