functionality updates

This commit is contained in:
2026-09-15 17:13:32 +06:00
parent bd7ac94e74
commit b8d3a44d22
11 changed files with 338 additions and 533 deletions

View File

@@ -46,20 +46,19 @@ cargo run --release --bin coap-hello-udp
cargo run --release --bin bridge
```
Then open <http://localhost:8080/> for a test console with a name field and a
button per route. Every response shows both the CoAP code and the HTTP status
it was mapped to; the raw CoAP code is also returned in an `X-Coap-Code` header.
Every response shows the CoAP code mapped onto an HTTP status, with the raw
CoAP code returned verbatim in an `X-Coap-Code` header.
These are now ordinary URLs — clickable, curl-able, bookmarkable:
| URL | Response |
|--------------------------------------------------|------------------------------|
| `http://localhost:8080/` | the test console |
| `http://localhost:8080/` | the CoAP reference page |
| `http://localhost:8080/hello` | `Hello, World!` |
| `http://localhost:8080/hello?name=Imran` | `Hello, Imran!` |
| `http://localhost:8080/health` | `{"status":"ok","uptime":12}`|
POST needs a body, so it is easiest from the console page or curl:
POST needs a body, so use curl:
```bash
curl -X POST -d "Imran" http://localhost:8080/hello
@@ -104,7 +103,7 @@ decoding.
| `src/lib.rs` | Shared CoAP client used by the CLI and the bridge. |
| `src/bin/client.rs` | CLI client for smoke tests. |
| `src/bin/bridge.rs` | HTTP -> CoAP proxy so a browser can reach the server. |
| `static/index.html` | The browser test console the bridge serves at `/`. |
| `static/index.html` | CoAP reference page: routes, codes, copyable commands. |
| `nodejs/` | The earlier Node.js version, kept for reference. |
## Config