Minimal local React + Express plant app🪩🪴
- Install dependencies:
npm install- Start server and client in parallel:
npm run dev- Open the app:
http://localhost:5173
After npm run dev is running:
- Frontend:
http://localhost:5173 - All plants endpoint:
http://localhost:3001/api/all_plants - Single plant endpoint (example):
http://localhost:3001/api/id/plant-1
GET /api/all_plants: returns all plantsGET /api/id/:id: returns one plant by id
The app now uses two add-flower modes:
- Localhost/dev (
localhostor127.0.0.1): new flowers are saved through the backend API. - Deployed demo (for example GitHub Pages): new flowers are temporary and only exist in the current tab. They disappear after page refresh.
This lets friends play with adding flowers without writing shared data.
You can force behavior with Vite env vars:
VITE_TEMP_FLOWERS_MODE=trueto always use temporary modeVITE_TEMP_FLOWERS_MODE=falseto always use backend-save modeVITE_API_BASE_URL=http://localhost:3001/api(or another API URL) to change backend target
This repository is configured for auto deploy with GitHub Actions.
- Open repository settings.
- Go to Pages.
- Under Build and deployment, choose Source: GitHub Actions.
- Push to the
mainbranch. - GitHub Action in
.github/workflows/deploy-pages.ymlbuilds and deploys the frontend. - Site URL:
https://unicornfarm5.github.io/greenhouse_princess/
- GitHub Pages only hosts the frontend.
- Backend write API is not deployed there.
- Deployed site therefore uses temporary flowers mode by default.