Skip to content

znuta/book-api

Repository files navigation

NestJS Application Overview

The provided application is a NestJS-based API designed for managing user-related operations and book entities. The key features include user sign-up, sign-in, and book management functionalities such as creating, reading, updating, and deleting books. The code structure adheres to NestJS conventions, employing separate modules for users and books, along with associated services, controllers, and entities.

Technologies Used

  • TypeScript: The application is developed using TypeScript, offering strong typing and improved developer experience.
  • TypeORM: TypeORM is utilized for database interactions, providing a seamless connection between the application and the database.
  • JWT Authentication: JSON Web Tokens (JWT) are employed for authentication purposes, ensuring secure user sign-in functionality.
  • Custom Response Classes: Custom response classes, including CustomResponse, SuccessResponse, and ErrorResponse, are implemented to provide standardized error and success responses.

How to Run and Test the Application

Follow these steps to run and test the NestJS application:

Install Dependencies

. Assumptions

  • You have mysql server installed and setup on your local machine. or to run it on Docker, Docker and Docker Compose are installed on the host machine.

Uncovered Requirements

No requirements have been left uncovered.

Source Code Configuration

  1. Clone the repository:

    git clone <https://github.com/znuta/book-api.git>

Navigate to the project directory:

cd book-api

Create a .env file in the project root and configure necessary environment variables.

Installation

$ yarn install

Build and run the Docker containers.

docker-compose up --build

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

The application will be running on http://localhost:3000 by default.

API Endpoints Explore the API endpoints available under /users and /books routes as indicated by the controllers. Refer to API documentation or code for details on available endpoints.

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Set Up Environment Variables Create a .env file at the project root with necessary environment variables, such as database connection details.

Database Setup Ensure the database is set up and running. For TypeORM, run migrations to create tables based on entities.

Postman Utilize this Postman to interact with the API. https://www.postman.com/galactic-sunset-703784/workspace/bookstore/collection/9896510-0b20fe09-8663-4cb3-853b-5d3158834416

Custom Response Handling Verify the correct implementation and usage of custom responses (CustomResponse, SuccessResponse, ErrorResponse) throughout the application. Ensure error and success responses adhere to defined structures.

Environment Variables in Production In a production environment, securely set environment variables using a suitable method, such as through the hosting platform or a configuration file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published