Skip to content

A simple rest api project implemented with TypeScript programming language, Node.js/NestJS framework, MongoDB database and RabbitMQ message broker.

License

Notifications You must be signed in to change notification settings

ariantron/nestjs_api

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

Users Web Service (NestJS)

A simple rest api project implemented with TypeScript programming language, Node.js/NestJS framework, MongoDB database and RabbitMQ message broker.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Contact

About The Project

This project was a REST application that included four APIs, each of these APIs is implemented in the project as follows:

Create User: This API is called with the post method, by sending fields related to user creation, including first name, last name, email, avatar, user information is stored in the MongoDB database. In addition, a message is sent to the user's email and a new RabbitMQ event is created.

Get User: In this API, which is called with the Get method, the user id parameter is received from the URL, and its information is received from the website https://reqres.in and sent in the form of json.

Get User Avatar: In this API, which is called with the Get method, the user id parameter is received from the URL, in the first call the image is downloaded and stored in the system, then the photo information including userId and base64-encoded image is stored in the images collection in the database and the link The avatar image is sent from the website https://reqres.in. In subsequent calls, the base64-encoded image received from the database is sent.

Delete user Avatar: In this API, which is called with the Delete method, the user id parameter is received from the URL, and the file related to the user's avatar image and its record are deleted in the database, and this is announced in the API response.

The end to end (e-2-e) tests are in the test folder, and the unit tests are written in the app.controller.spec and user.controller.spec.ts files at the address's "src/modules/user" and "src/modules/app" respectively.

The project's private information is stored in the .env file, whose template is .env.example. The project database is provided through the MongoDB Atlas cloud service, the RabbitMQ service through cloudamqp.com and the email SMTP server from the mailtrap.io website. The postman collection file named "postman_collection.json" is placed in the project.

Built With

  • TypeScript
  • Nest
  • MongoDB
  • RabbitMQ

(back to top)

Getting Started

Prerequisites

  • npm
$ npm install npm@latest -g

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

(back to top)

License

Distributed under the GPL-3.0 License. See LICENSE.txt for more information.

(back to top)

Contact

Arian Tron - @ariantron - ariantron@yahoo.com

Project Link: https://github.com/ariantron/nestjs_api

(back to top)

About

A simple rest api project implemented with TypeScript programming language, Node.js/NestJS framework, MongoDB database and RabbitMQ message broker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published