This project is a simple full-stack application using React for the frontend and Express.js for the backend. It demonstrates a basic setup where the frontend interacts with the backend via RESTful API calls.
- React: A frontend library developed by Facebook for building user interfaces.
- Express: A minimal and flexible Node.js web application framework that provides robust features for web and mobile applications.
- Environment Variables: Use of dotenv for managing environment settings.
- Error Handling: Robust error handling for both frontend and backend.
- Logging: Using morgan to log HTTP requests.
- API Documentation: Swagger for documenting the API endpoints.
- Database: MongoDB integration for data persistence.
Before you begin, ensure you have the following installed:
Clone the repository to your local machine:
git clone https://github.com/barl-community/react-express-app.git
cd react-express-app
Navigate to the backend directory and install dependencies:
npm install
Start the backend server:
node server.js
Navigate to the client
directory, install dependencies, and start the frontend server:
cd client
npm install
npm start
The React application will open up in your browser at http://localhost:3000
.
Create a .env
file in the root of your project and one inside the client
directory with the necessary environment variables:
- Root
.env
:
PORT=5000
MONGODB_URI=your_mongodb_connection_string
- Client
.env
:
REACT_APP_API_URL=http://localhost:5000
Access the API documentation by navigating to http://localhost:5000/api-docs
in your web browser.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
`LICENSE