/nestjs-user-crud-typeormsql-api

This is a simple NestJs app that create a CRUD for the users entity

Primary LanguageTypeScriptMIT LicenseMIT

Project logo

user-crud-api

This project was generated using NestJs.

DonNy88


📝 Table of Contents

🧐 About

This is a simple NestJs app that create a CRUD for the users entity and resolve the following problem:

  • Create an endpoint to create new user (check if the user exist)
  • Create an endpoint to provide full user info by id (check if the user exist)
  • Create an endpoint to get users with queries parameter: pageIndex, pageSize, search, sort

The User entity has this fields: id, name, middleName, surname, birthPlace, birthDate. The middleName is optional and the format of the birthDate is ISO 8601.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You need to install these packages:

Installing

For install all deps you need to perform this command:

yarn

or

npm install

Local environments variables settings

This NestJs uses some environments variables. To let you coding without set them on your local machine you can simple copy the file .env.example into .env.

🔧 Running the tests

This porject use Jest as testing tools. To run all test use this command:

yarn test

or

npm run test

If you would like to run test while you are coding you can use the command:

yarn test:watch

or

npm run test:watch

🎈 Usage

Before to run this NestJs app you need a postgres db. You can have an instance of postgres db with docker and running this command:

docker compose up

NB: the first time it may take a while, please, patient.

You can run this project in development mode with these command:

yarn start:dev

or

npm run start:dev

If you do not need run this is in development mode you can simply run:

yarn start

or

npm run start

After the start up, you can find Swagger doc of the backend at http://localhost:3000/docs.

✍️ Authors