https://github.com/galibmia/toy-shop-server
https://github.com/galibmia/toy-shop-server
cors dotenv expressjs mongodb
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/galibmia/toy-shop-server
- Owner: galibmia
- Created: 2024-08-10T19:04:04.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T13:18:15.000Z (10 months ago)
- Last Synced: 2025-01-08T01:36:58.150Z (5 months ago)
- Topics: cors, dotenv, expressjs, mongodb
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Toy Shop Server
This is the backend server for the Toy Shop website, built using the MERN stack (MongoDB, Express.js, React.js, Node.js). The server handles all the backend operations, including user authentication, product management, and order processing.
## Features
- **User Authentication:** Secure login and registration functionality using JWT tokens.
- **Product Management:** APIs for adding, updating, and deleting toy listings.
- **Order Management:** APIs for handling customer orders.
- **Database Integration:** Efficient data handling with MongoDB.
- **Error Handling:** Robust error handling for reliable operations.## Technologies Used
- MongoDB
- Express.js
- Node.js
- JWT (JSON Web Tokens)## Getting Started
1. Clone the repository:
```bash
git clone https://github.com/galibmia/toy-shop-server.git
```2. Install dependencies:
```bash
npm install
```3. Set up environment variables:
Create a `.env` file in the root directory and add the following:
```plaintext
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
```4. Run the server:
```bash
npm start
```## API Endpoints
### Auth
- **POST /api/auth/register**: Register a new user
- **POST /api/auth/login**: Login a user### Products
- **GET /api/products**: Get all products
- **POST /api/products**: Add a new product
- **PUT /api/products/:id**: Update a product
- **DELETE /api/products/:id**: Delete a product### Orders
- **GET /api/orders**: Get all orders
- **POST /api/orders**: Place a new order## Contributing
Feel free to explore the code and contribute to the project! Fork the repository and submit a pull request with your improvements.
## License
This project is licensed under the MIT License.