A robust RESTful API backend for a food delivery application, built with Node.js, Express, and MongoDB.
- User authentication and authorization
- Food item management
- Order processing
- Review system
- Role-based access control
- Rate limiting
- Error handling
- Docker support
- Node.js (v16 or higher)
- MongoDB
- npm or Yarn
- Docker (optional)
- Clone the repository:
git clone https://github.com/maro14/foodie-backend.git
cd foodie-backend
- Install dependencie 7EDD s:
npm install
# or using Yarn
yarn install
- Set up environment variables:
Create a
.env
file in the root directory with the following variables:
NODE_ENV=development
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=24h
CORS_ORIGIN=*
- Start the development server:
npm run dev
# or using Yarn
yarn dev
The server will be running at http://localhost:5000
- POST
/users/register
- Register a new user - POST
/users/login
- User login
- GET
/items
- Get all items - POST
/items
- Add new item - GET
/items/:id
- Get specific item - PUT
/items/:id
- Update item - DELETE
/items/:id
- Delete item
- GET
/orders
- Get all orders - POST
/orders
- Create new order - GET
/orders/:id
- Get specific order
- POST
/items/:itemId/reviews
- Add review for an item - GET
/items/:itemId/reviews
- Get item reviews
Run the test suite:
npm test
Run tests in watch mode:
npm run test:watch
Generate coverage report:
npm run test:coverage
Build and run using Docker:
docker-compose up --build
Access the containerized application at http://localhost:5000
This project is licensed under the MIT License.