Skip to content

wallycoding/todo-clean-api

Repository files navigation

Todo Clean API

Live Coding

Watch the video of this project here

Running the containers

# start development
$ make dev.up

# stop development
$ make dev.down

Access Containers

# Application
$ docker exec -it api sh

# PostgresSQL
$ docker exec -it db bash

Running prisma migration

$ npx prisma migrate dev
# 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

Goals

  • Configuration
    • Docker
    • Prisma client
    • Jest
    • Global pipes
    • Cors
    • Swagger
  • Prisma Service
    • Test prisma
    • Prisma service
  • Domain
    • Entities
    • Repository
  • DTO
    • Test (Write todo & update todo)
    • Write todo & update todo
  • Todo
    • Data
      • Test prisma adapter
      • Prisma adapter
    • Services
      • Test todo service
      • Todo Service
    • Controllers
      • Test todo controller
      • todo controller
  • Tests
    • Test e2e

Application structure

  • src

    • main.ts
      • nest.js bootstrap
    • app.module.ts
      • loads all modules
    • modules
      • {name}
        • controllers
          • {name}.controller.spec.ts
          • {name}.controller.ts
        • services
          • {name}.service.spec.ts
          • {name}.service.ts
        • data
          • adapters
            • {name}
              • {name}.adapter.spec.ts
              • {name}.adapter.ts
        • domain
          • entities
            • {name}.ts
          • repository
            • {name}.ts
        • dto
          • {name}.dto.spec.ts
          • {name}.dto.ts
        • {name}.module.ts
  • test

    • utils
      • Utilities for application testing
    • {name}.e2e-spec.ts
      • Tests e2e

App Routes

  • /todo/list (GET)
  • /todo/:id (GET)
  • /todo/add (POST)
  • /todo/:id (PATCH)
  • /todo/:id (DELETE)

Tests Coverage

Tests Coverage

Tests e2e

Tests e2e

Patterns and paradigms

  • (OOP) Object-Oriented Programming
  • (TDD) Test-Driven Development
  • (DDD) Domain-Driven Design
  • (DI) Dependency Injection
  • (DIP) Dependency Inversion Principle
  • (DTO) Data Transfer Object
  • (DP) Decorator Pattern

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published