Skip to content

Commit

Permalink
Add a README so I don't forget how this thing works
Browse files Browse the repository at this point in the history
sidoh committed Oct 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 41cfbc0 commit df5a64b
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions web2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Web UI

This contains the web UI for espMH. The UI is written with the following stack:

* Typescript
* React
* Tailwind
* Shadcn/ui
* esbuild

It compiles everything into C++ header files which are copied to `dist` and included as a part of the platformio build process.

## Development

It _should_ be enough to install node v20+ and run:

```bash
npm run watch
```

This will continuously run the build as files change. When I develop, I typically also use the nodejs server:

```bash
PROXY_URL=http://hostname-of-your-hub node server.js
```

I do this only to proxy API requests to an actual ESP8266 running on my local network.

### API Client

The API client in `web2/api` is generated from the openapi spec using `openapi-zod-client`. Run it with this command:

```bash
openapi-zod-client ../docs/openapi.yaml -o ./api/api-zod.ts --with-description
```
2 changes: 1 addition & 1 deletion web2/server.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ const path = require('path');

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

const proxyMiddleware = createProxyMiddleware({
target: PROXY_URL,

0 comments on commit df5a64b

Please sign in to comment.