41 lines
1.3 KiB
Markdown
41 lines
1.3 KiB
Markdown
# Test Static Site
|
|
|
|
Test repository for Docker Watcher's Static Sites feature.
|
|
|
|
## Structure
|
|
|
|
```
|
|
pages/
|
|
├── index.html # Main page
|
|
├── style.css # Styles
|
|
├── app.js # Client-side JS
|
|
└── api/
|
|
├── time.ts # GET /api/time — server time
|
|
├── hello.ts # GET /api/hello?name=X — greeting with env var
|
|
└── echo.ts # POST /api/echo — echo request body
|
|
```
|
|
|
|
## API Convention
|
|
|
|
Functions prefixed with `API_` are auto-routed:
|
|
- `API_get` in `api/time.ts` → `GET /api/time`
|
|
- `API_post` in `api/echo.ts` → `POST /api/echo`
|
|
|
|
## Environment Variables
|
|
|
|
- `GREETING_PREFIX` — custom greeting prefix (default: "Hello")
|
|
|
|
## Editor Setup
|
|
|
|
The `pages/` folder contains a `deno.json` so Deno-aware editors pick up the
|
|
correct globals (`Deno.env`, `Deno.serve`, etc.).
|
|
|
|
**VS Code:** install the
|
|
[Deno extension](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno)
|
|
and enable it for the `pages/` folder (it should pick up `deno.json`
|
|
automatically).
|
|
|
|
**JetBrains IDEs:** the built-in Deno plugin works the same way.
|
|
|
|
Without a Deno-aware editor, `Deno.env` will show as an undefined identifier
|
|
— but the code still runs correctly inside the generated container. |