Skip to content

Commit 1e20473

Browse files
committed
docs: expand local run and testing instructions
1 parent ac199b5 commit 1e20473

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Serve a built SPA bundle over HTTP with sensible defaults for caching and option
1515
docker run --rm -p 8080:8080 -v $(pwd)/dist:/code devforth/spa-to-http:latest
1616
```
1717

18+
For local (non-Docker) runs, see [Local Run (Console)](docs/getting-started.md#local-run-console).
19+
1820
## Key Features
1921

2022
- Zero-configuration Docker setup for common SPA outputs

docs/getting-started.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,55 @@
77
- Docker (recommended)
88
- A built SPA bundle (for example, `dist/` from Vite, Webpack, or similar)
99

10-
## Serve a Local Build
10+
## Local Run (Console)
11+
12+
Build from source and run the server directly:
13+
14+
```bash
15+
cd src
16+
go build -o spa-to-http
17+
./spa-to-http --directory ../test/frontend/dist
18+
```
19+
20+
Or run without building a binary:
21+
22+
```bash
23+
cd src
24+
go run . --directory ../test/frontend/dist
25+
```
26+
27+
Open `http://localhost:8080` in your browser.
28+
29+
### Configure via CLI Flags
30+
31+
```bash
32+
cd src
33+
go run . \
34+
--directory ../test/frontend/dist \
35+
--brotli \
36+
--gzip \
37+
--spa=true \
38+
--logger \
39+
--log-pretty \
40+
--cache-max-age 3600 \
41+
--threshold 2048
42+
```
43+
44+
### Configure via Environment Variables
45+
46+
```bash
47+
cd src
48+
ADDRESS=0.0.0.0 PORT=8080 \
49+
GZIP=true BROTLI=true \
50+
SPA_MODE=true LOGGER=true LOG_PRETTY=true \
51+
CACHE_MAX_AGE=3600 THRESHOLD=2048 \
52+
DIRECTORY=../test/frontend/dist \
53+
go run .
54+
```
55+
56+
Full list of options is in [Configuration](configuration.md).
57+
58+
## Serve a Local Build (Docker)
1159

1260
```bash
1361
# Serve ./dist at http://localhost:8080
@@ -39,6 +87,25 @@ Build and run:
3987
docker build -q . | xargs docker run --rm -p 8080:8080
4088
```
4189

90+
## Test With `test/frontend/dist`
91+
92+
Use the built-in fixture to verify routing, caching, and compression behavior.
93+
94+
### Console
95+
96+
```bash
97+
cd src
98+
go run . --directory ../test/frontend/dist
99+
```
100+
101+
### Docker
102+
103+
```bash
104+
docker run --rm -p 8080:8080 -v $(pwd)/test/frontend/dist:/code devforth/spa-to-http:latest
105+
```
106+
107+
Open `http://localhost:8080` in your browser.
108+
42109
## Next Steps
43110

44111
- Configure compression, cache settings, and ports in [Configuration](configuration.md)

0 commit comments

Comments
 (0)