Example Projects
ZyveraWeb creates two example Node.js projects on first run to help you get started.
Demo Project
Location: plugins/ZyveraWeb/site/demo/
A simple API backend with a vanilla JavaScript frontend.
Frontend (public/)
A basic HTML page with buttons to call the API endpoints and display results.
Backend (server.js)
Three API endpoints:
| Route | Method | Description |
|---|---|---|
/api/info |
GET | Returns server info with timestamp |
/api/echo |
GET | Echoes back the request details (method, path, query, headers, body) |
/api/message |
POST | Accepts JSON {"name": "..."} and returns a personalized greeting |
Usage
- Open
http://your-server:8080(if configured as default) or the appropriate domain. - Click buttons to test each API endpoint.
- Use as a reference for building your own Node.js sites.
React Demo Project
Location: plugins/ZyveraWeb/site/react-demo/
An API backend with a React SPA frontend.
Frontend (public/)
A React single-page application loaded from CDN via <script> tags. No build step required. Demonstrates:
- React component structure in a single HTML file
- Fetching data from the API backend
- Rendering dynamic content with React
Backend (server.js)
A simple JSON API:
| Route | Method | Description |
|---|---|---|
/api/info |
GET | Returns server info |
Usage
- Open the site in a browser.
- The React app loads and fetches data from the API.
- Use as a starting point for React SPA development.
Adding Your Own Projects
Create a new folder under site/ with this structure:
plugins/ZyveraWeb/site/my-project/
├── server.js # Backend handler
├── public/ # Static frontend files
└── package.json # npm dependencies
Then add a site entry in config.yml:
sites:
- domain: "myapp.example.com"
dir: "site/my-project"
Run /zyveraweb server restart to apply the changes. The plugin will auto-install npm dependencies.
Removing Example Projects
The example projects are created only on first run. If you delete them and restart, they will not be recreated. To manually remove them:
rm -rf plugins/ZyveraWeb/site/demo
rm -rf plugins/ZyveraWeb/site/react-demo
No comments to display
No comments to display