diff --git a/README.md b/README.md index decf9a9..0a3a340 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ xtc build -o out chess-game/db/src/main/x/chessDB.x xtc build -o out -L out -r chess-game/app/webapp chess-game/app/src/main/x/chess.x # chess.examples.org is @WebApp — needs the XQIZ.IT platform to host -# Welcome (requires npm build in welcome/webapp/ first) +# Welcome (build the React frontend first: cd welcome/webapp && npm install && npm run build) xtc build -o out -r welcome/webapp welcome/src/main/x/*.x xtc run -L out welcomeTest # standalone DB console app # welcome.examples.org / welcomeCLI.examples.org are @WebApp — need the XQIZ.IT platform @@ -251,6 +251,10 @@ xtc build -o out -L out -r chess-game/app/webapp chess-game/app/src/main/x/chess A "hello world" web application with a React frontend. Demonstrates `@WebApp`, database integration (`oodb`), static content serving, and a CLI management tool. +The frontend in `welcome/webapp` is built with Vite (Node.js 20.19+ or 22.12+ when not using the +Gradle-downloaded Node). `npm start` (or `npm run dev`) serves it on http://localhost:3000 with hot +reload; the `/welcome/*` API calls need the backend hosted on the XQIZ.IT platform. + The `welcomeTest` module is a standalone console app that exercises the database layer directly. It opens a `jsondb` connection to the `welcomeDB` schema, looks up a guest entry in the `counters` map, increments it, and prints the visit count: diff --git a/welcome/webapp/package.json b/welcome/webapp/package.json index 81376d1..3c92ab2 100644 --- a/welcome/webapp/package.json +++ b/welcome/webapp/package.json @@ -12,8 +12,11 @@ "vite": "^8.3.1" }, "scripts": { + "start": "vite", "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "test": "echo \"No frontend tests: the Create React App boilerplate test was removed in the move to Vite.\" && exit 1", + "eject": "echo \"Nothing to eject: the Vite build configuration is already in vite.config.js.\"" } } diff --git a/welcome/webapp/vite.config.js b/welcome/webapp/vite.config.js index 5d4dbb7..9c2a3fc 100644 --- a/welcome/webapp/vite.config.js +++ b/welcome/webapp/vite.config.js @@ -8,4 +8,9 @@ export default defineConfig({ build: { outDir: 'build', }, + // Keep the Create React App dev-server defaults (port 3000, open a browser) for `npm start`. + server: { + port: 3000, + open: true, + }, });