@gjsify/example-node-express-webserver 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,31 +1,72 @@
1
1
  # @gjsify/example-node-express-webserver
2
2
 
3
- An Express 5 blog showcase — JSON API + static frontend — running on GJS using gjsify's Node.js polyfills (`@gjsify/http`, etc.). The same source also builds for Node.js, demonstrating that a real Express web application runs unmodified on GJS via the `@gjsify/*` Node API layer.
3
+ An Express 5 blog showcase — JSON API + static frontend — running on GJS using gjsify's Node.js polyfills (`@gjsify/http` over libsoup 3). The same source also builds for Node.js, Bun and Deno, demonstrating that a real Express web application runs unmodified on GJS via the `@gjsify/*` Node API layer.
4
4
 
5
5
  Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
6
 
7
+ ## Targets
8
+
9
+ | Target | Bundle | Platform glue |
10
+ |---|---|---|
11
+ | GJS | `dist/index.gjs.js` (`--app gjs`) | `@gjsify/http` + `@gjsify/http-soup-bridge` → libsoup 3 |
12
+ | Node · Bun · Deno | `dist/index.node.mjs` (`--app node`) | the runtime's own `node:http` |
13
+
14
+ One unchanged Express app, both bundles — no server-side forks. Declared portable across Linux, macOS and Windows (`gjsify.os`).
15
+
16
+ ## Prerequisites
17
+
18
+ GJS ≥ 1.86 with libsoup 3. `gjsify system-check` reports what is missing.
19
+
7
20
  ## Run
8
21
 
9
22
  ```bash
10
- # Build first
23
+ # Build first (gjs + node bundles and the static frontend)
11
24
  gjsify run build
12
25
 
13
26
  # GJS (Express over GJS + Soup HTTP)
14
27
  gjsify showcase express-webserver
15
28
  # or: gjsify run start
16
29
 
17
- # Node.js (for comparison)
18
- gjsify run start:node
30
+ # Node.js / Bun / Deno (for comparison)
31
+ gjsify showcase express-webserver --runtime node # or: bun | deno
32
+ # or: gjsify run start:node
19
33
  ```
20
34
 
21
35
  Then open `http://localhost:3000` in a browser.
22
36
 
37
+ ## Routes
38
+
39
+ | Route | Serves |
40
+ |---|---|
41
+ | `GET /` | the static frontend from `src/public/` |
42
+ | `GET /api/posts` | the post list as JSON |
43
+ | `GET /api/posts/:slug` | a single post as JSON |
44
+ | `GET /api/runtime` | which runtime is serving the request |
45
+ | `GET /posts/:slug` | server-rendered post page |
46
+
23
47
  ## What it demonstrates
24
48
 
25
- - Express 5 running on GJS with gjsify's `@gjsify/http` (Soup 3.0 backend)
49
+ - Express 5 running **unmodified** on GJS with gjsify's `@gjsify/http` (libsoup 3 backend)
50
+ - The Node HTTP server surface Express builds on — `http.createServer`, request/response streams, headers, status codes — implemented over GNOME libraries
51
+ - Express middleware and routing on GJS: `express.json()`, custom middleware, route params, `express.static()`
26
52
  - JSON REST API + static file serving from a single Express app
27
- - Same source building for both `--app gjs` and `--app node` targets
28
- - Node.js polyfill layer compatibility with an unmodified npm package
53
+ - The same source building for `--app gjs` and `--app node`, and ONE `--app node` bundle serving Node, Bun and Deno (Node-API is their common ABI)
54
+ - Node.js polyfill-layer compatibility with an unmodified npm package — the showcase is a compatibility probe, so any gap surfaces here and is fixed in the package, not worked around here
55
+
56
+ ## Layout
57
+
58
+ ```
59
+ src/
60
+ index.ts the Express app (routes, middleware, listen)
61
+ data/posts.ts the in-memory post data
62
+ public/ static frontend (index.html, app.js, style.css)
63
+ ```
64
+
65
+ ## Related
66
+
67
+ - [`@gjsify/http`](../../../packages/node/http) — the `node:http` implementation this exercises
68
+ - [`@gjsify/http-soup-bridge`](../../../packages/node/http-soup-bridge) — the libsoup 3 transport behind it
69
+ - [`minimalist-browser`](../../dom/minimalist-browser) — the browser-side counterpart (WebKit content area on GJS)
29
70
 
30
71
  ## License
31
72