https://github.com/rohittcodes/reqres-api
https://github.com/rohittcodes/reqres-api
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rohittcodes/reqres-api
- Owner: rohittcodes
- Created: 2024-08-26T05:11:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-26T10:27:40.000Z (almost 2 years ago)
- Last Synced: 2025-10-04T23:00:42.493Z (9 months ago)
- Language: TypeScript
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://reqres.in/api)
[](https://nestjs.com/)
# Uses [Reqres.in](https://reqres.in/api) API Endpoints
A RESTful API built using [NestJS](https://nestjs.com/).
## Running the API
### Prerequisites
- Node.js
- npm or yarn (yarn is recommended)
- Docker (optional)
- RabbitMQ (docker image is available or you can install it locally)
### Installation
```bash
# Install dependencies
$ npm install # or yarn
```
### Configuration
Create a `.env` file in the root of the project and add the following environment variables from the `.env.example` file.
```bash
# .env
REQRES_API_URL=https://reqres.in/api
MONGODB_URI=mongodb+srv://your-username:your-password@your-cluster-url/?retryWrites=true&w=majority&appName=your-app-name
USER_SERVICE_URL=amqp://localhost:5672
```
### Running the API
> Note: Make sure you have RabbitMQ running locally or you can use the docker image.
```bash
# Run the API in watch mode
$ npm run start:dev # or yarn start:dev
```
## Test
### Unit Tests
```bash
# unit tests
$ npm run test # or yarn test
```
## API Endpoints
### Users
- GET `/user/:id` - Get a user by ID
- POST `/users` - Create a new user and send a welcome email using RabbitMQ
- GET `/users/:id/avatar` - Get a user's avatar and store it in the database and the file system (if it doesn't exist)
- DELETE `/users/:id/avatar` - Delete a user's avatar from the database and the file system