Skip to content

Commit ada36ff

Browse files
committed
Improve support for "Single Page Applications"
SPAs usually require to serve the contents from "index.html" for paths not matching a resource on the local filesystem. This allows for clean refresh operations without returning 404 errors.
1 parent 6cef83e commit ada36ff

File tree

7 files changed

+146
-82
lines changed

7 files changed

+146
-82
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
needs: scan
6666
strategy:
6767
matrix:
68-
go-version: [1.17.x, 1.18.x, 1.19.x]
68+
go-version: [1.18.x, 1.19.x]
6969
os: [ubuntu-latest]
7070
runs-on: ${{ matrix.os }}
7171
timeout-minutes: 15

cli/cmd/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ func runServer(_ *cobra.Command, args []string) error {
4646
if err != nil {
4747
return err
4848
}
49-
defer oop.Shutdown(context.TODO())
49+
defer oop.Shutdown(context.Background())
5050

5151
// setup and start server
5252
mux := http.NewServeMux()
5353
mux.Handle("/", http.FileServer(http.Dir(fp)))
54-
srv, err := pkgHttp.NewServer(conf.ServerOptions(mux, oop)...)
54+
srv, err := pkgHttp.NewServer(conf.ServerOptions(mux, fp, oop)...)
5555
if err != nil {
5656
return err
5757
}

go.mod

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
require (
66
github.com/spf13/cobra v1.6.1
77
github.com/spf13/viper v1.14.0
8-
go.bryk.io/pkg v0.0.0-20221107190726-b44fea14d455
8+
go.bryk.io/pkg v0.0.0-20221205162008-49c0665c09b1
99
)
1010

1111
require (
@@ -16,7 +16,7 @@ require (
1616
github.com/fatih/color v1.13.0 // indirect
1717
github.com/felixge/httpsnoop v1.0.3 // indirect
1818
github.com/fsnotify/fsnotify v1.6.0 // indirect
19-
github.com/getsentry/sentry-go v0.14.0 // indirect
19+
github.com/getsentry/sentry-go v0.15.0 // indirect
2020
github.com/go-logr/logr v1.2.3 // indirect
2121
github.com/go-logr/stdr v1.2.2 // indirect
2222
github.com/go-ole/go-ole v1.2.6 // indirect
@@ -25,7 +25,7 @@ require (
2525
github.com/gorilla/websocket v1.5.0 // indirect
2626
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
2727
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
28-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.13.0 // indirect
28+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 // indirect
2929
github.com/hashicorp/hcl v1.0.0 // indirect
3030
github.com/inconshreveable/mousetrap v1.0.1 // indirect
3131
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
@@ -37,7 +37,7 @@ require (
3737
github.com/pelletier/go-toml v1.9.5 // indirect
3838
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
3939
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
40-
github.com/prometheus/client_golang v1.13.1 // indirect
40+
github.com/prometheus/client_golang v1.14.0 // indirect
4141
github.com/prometheus/client_model v0.3.0 // indirect
4242
github.com/prometheus/common v0.37.0 // indirect
4343
github.com/prometheus/procfs v0.8.0 // indirect
@@ -56,30 +56,30 @@ require (
5656
go.opentelemetry.io/contrib/instrumentation/host v0.34.0 // indirect
5757
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0 // indirect
5858
go.opentelemetry.io/contrib/instrumentation/runtime v0.34.0 // indirect
59-
go.opentelemetry.io/otel v1.10.0 // indirect
60-
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
59+
go.opentelemetry.io/otel v1.11.1 // indirect
60+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect
6161
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 // indirect
6262
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.31.0 // indirect
63-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
64-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
63+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 // indirect
64+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 // indirect
6565
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 // indirect
66-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 // indirect
66+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 // indirect
6767
go.opentelemetry.io/otel/metric v0.31.0 // indirect
68-
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
68+
go.opentelemetry.io/otel/sdk v1.11.1 // indirect
6969
go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect
70-
go.opentelemetry.io/otel/trace v1.10.0 // indirect
70+
go.opentelemetry.io/otel/trace v1.11.1 // indirect
7171
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
7272
go.uber.org/atomic v1.9.0 // indirect
7373
go.uber.org/multierr v1.8.0 // indirect
74-
go.uber.org/zap v1.23.0 // indirect
75-
golang.org/x/net v0.1.0 // indirect
74+
go.uber.org/zap v1.24.0 // indirect
75+
golang.org/x/net v0.2.0 // indirect
7676
golang.org/x/sync v0.1.0 // indirect
77-
golang.org/x/sys v0.1.0 // indirect
78-
golang.org/x/term v0.1.0 // indirect
77+
golang.org/x/sys v0.2.0 // indirect
78+
golang.org/x/term v0.2.0 // indirect
7979
golang.org/x/text v0.4.0 // indirect
80-
golang.org/x/time v0.1.0 // indirect
81-
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
82-
google.golang.org/grpc v1.50.1 // indirect
80+
golang.org/x/time v0.3.0 // indirect
81+
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1 // indirect
82+
google.golang.org/grpc v1.51.0 // indirect
8383
google.golang.org/protobuf v1.28.1 // indirect
8484
gopkg.in/ini.v1 v1.67.0 // indirect
8585
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)