Rest Api

screenshot of Rest Api

Rest Api

template for rest api

Overview

This product is a Template for building REST APIs. It provides automated commands for generating components for the backend. The commands can be executed using either yarn or npm. The template includes features such as dependency management, alias paths, testing, documentation, and commit conventions.

Features

  • Automated commands for generating backend components
  • Dependency management with yarn
  • Alias paths for easy file referencing
  • Testing framework for unit and integration tests
  • Integration with Swagger for API documentation
  • Customizable environment variables
  • Commit convention for standardized git commits

Installation

  1. Install the required dependencies:
yarn install

or

npm install
  1. Set up alias paths:
  • Add new aliases to the following files: tsconfig.json, jest-e2e.json, and jest.config.json. Use @modules/* to point to the path src/modules/ and @shared/* to point to the path src/shared/.
  1. Run tests:
  • Execute unit tests using the following naming pattern: <file-name>.spec.ts
yarn run test:unit
  • Execute integration tests using the following naming pattern: <file-name>.test.ts
yarn run test:integration
  1. Start the application in watch mode:
yarn run dev
  1. Start the application:
yarn start
  1. Access the Swagger documentation by visiting the endpoint provided after starting the application.
http://localhost:<port>/swagger
  1. Define environment variables:
  • Set the environment variables in the file src/shared/env.ts.
  • Define the variables in the .env file.

Summary

The Rest Api Template is a versatile tool for building REST APIs. It offers automated commands for generating backend components, dependency management with yarn, alias paths for easy file referencing, testing capabilities for unit and integration tests, Swagger integration for API documentation, customizable environment variables, and a commit convention for standardized git commits. With detailed installation instructions, users can quickly set up and start using this template for their API development needs.