Skip to content

I am currently learning NestJS to enhance my backend development skills.API CRUD done using NESTJS.

Notifications You must be signed in to change notification settings

MRMutahir/NestJS_CRUD

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

This repository contains a simple implementation of CRUD (Create, Read, Update, Delete) operations for managing users using NestJS. The API allows you to add, retrieve, update, and delete users with appropriate HTTP methods and status codes.

Features

  • Add User: Create a new user and store it in memory.
  • Get All Users: Retrieve a list of all users.
  • Get Single User: Retrieve a single user by their ID.
  • Update User: Update an existing user's details by their ID.
  • Delete User: Remove a user by their ID and return the remaining users.

Endpoints

  1. Add User

    • Method: POST
    • URL: /users/v1/addUser
    • Body (JSON):
      {
        "id": 1,
        "name": "John Doe",
        "email": "john@example.com"
      }
    • Response:
      {
        "usersData": [...]
      }
  2. Get All Users

    • Method: GET
    • URL: /users/v1/getUsers
    • Response:
      {
        "usersData": [...]
      }
  3. Get Single User

    • Method: GET
    • URL: /users/v1/getUser/:id
    • Path Variable: id (e.g., 1)
    • Response:
      {
        "user": {...}
      }
  4. Update User

    • Method: PUT
    • URL: /users/v1/updateUser/:id
    • Path Variable: id (e.g., 1)
    • Body (JSON):
      {
        "id": 1,
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    • Response:
      {
        "user": {...}
      }
  5. Delete User

    • Method: DELETE
    • URL: /users/v1/deleteUser/:id
    • Path Variable: id (e.g., 1)
    • Response:
      {
        "message": "User deleted successfully",
        "newData": [...]
      }

Installation

$ yarn install



Running the app
# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod


Test
# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch
Author - Muhammad Mutahir
Website - https://nestjs.com
Twitter - @nestframework
License
Nest is MIT licensed.

About

I am currently learning NestJS to enhance my backend development skills.API CRUD done using NESTJS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published