A simple full-stack project with a Node.js/Express backend and a React (Vite) frontend.
-
Backend (Express):
/— Returns a hello message./quote— Returns an inspirational quote./healtTip— Returns a health tip.- 404 and error handling for undefined routes.
-
Frontend (React + Vite):
/— Home page./quote— Displays the quote from the backend./healtTip— Displays the health tip from the backend.- Navigation between routes using React Router.
- Node.js (v16 or higher recommended)
- npm
git clone <your-repo-url>
cd fetchBackend:
cd backend
npm installFrontend:
cd ../frontend
npm install- In the
backendfolder, you can create a.envfile to specify a custom port:PORT=3000 - In the
frontendfolder, create a.envfile and set the backend URL:VITE_BACKEND_URL=http://localhost:3000
Start the backend:
cd backend
npm start
# or
npx nodemon server.jsStart the frontend:
cd ../frontend
npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:3000
fetch/
backend/
app.js
server.js
package.json
...
frontend/
src/
App.jsx
AppRouter.jsx
componets/
HealthTip.jsx
Quote.jsx
...
package.json
...
.gitignore
README.md
This project is for learning and demonstration purposes.