A React frontend application for consuming the nodejs-simpleapi-with-db API.
- View server health information (auto-refreshes every 30 seconds)
- Create, view, and delete users
- Create, view, and delete messages
- Responsive design with modern UI
- Error handling and loading states
- Install dependencies:
npm install
- Set up environment variables (optional):
Create a
.env
file in the root directory:
REACT_APP_API_URL=http://localhost:3001
If not set, the app will use relative URLs assuming the API is served from the same domain.
- Start the development server:
npm start
The app will be available at http://localhost:3000
.
This frontend expects the following API endpoints:
GET /health
- Server health informationGET /users
- Get all usersPOST /users
- Create a new userDELETE /users/:id
- Delete a userGET /messages
- Get all messagesPOST /messages
- Create a new messageDELETE /messages/:id
- Delete a message
src/
├── components/
│ ├── ServerInfo.js # Server health component
│ ├── UserSection.js # User management component
│ └── MessageSection.js # Message management component
├── App.js # Main application component
├── index.js # React entry point
└── index.css # Global styles
npm start
- Start development servernpm build
- Build for productionnpm test
- Run testsnpm run eject
- Eject from Create React App
- React 18
- Create React App
- Modern JavaScript (ES6+)
- CSS3 with Flexbox