Skip to content

Commit df5a64b

Browse files
committed
Add a README so I don't forget how this thing works
1 parent 41cfbc0 commit df5a64b

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

web2/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Web UI
2+
3+
This contains the web UI for espMH. The UI is written with the following stack:
4+
5+
* Typescript
6+
* React
7+
* Tailwind
8+
* Shadcn/ui
9+
* esbuild
10+
11+
It compiles everything into C++ header files which are copied to `dist` and included as a part of the platformio build process.
12+
13+
## Development
14+
15+
It _should_ be enough to install node v20+ and run:
16+
17+
```bash
18+
npm run watch
19+
```
20+
21+
This will continuously run the build as files change. When I develop, I typically also use the nodejs server:
22+
23+
```bash
24+
PROXY_URL=http://hostname-of-your-hub node server.js
25+
```
26+
27+
I do this only to proxy API requests to an actual ESP8266 running on my local network.
28+
29+
### API Client
30+
31+
The API client in `web2/api` is generated from the openapi spec using `openapi-zod-client`. Run it with this command:
32+
33+
```bash
34+
openapi-zod-client ../docs/openapi.yaml -o ./api/api-zod.ts --with-description
35+
```

web2/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('path');
44

55
const app = express();
66
const PORT = 3000; // You can change this to any port you prefer
7-
const PROXY_URL = 'http://10.133.8.88'; // Replace with your proxy URL
7+
const PROXY_URL = process.env.PROXY_URL || 'http://10.133.8.88'; // Replace with your proxy URL
88

99
const proxyMiddleware = createProxyMiddleware({
1010
target: PROXY_URL,

0 commit comments

Comments
 (0)