Skip to content

DevSazal/todo-nestjs-backend

Repository files navigation

To-Do NestJS Backend (+E2E)

exploration of rest api with testable code

Requirements:

  • Node.js
  • NPM
  • TypeScript, NestJS v10.0.0
  • Git
  • MongoDB

Let's clone the repository on your machine.

The application includes the following files and folders.

  • src - code for the application written in TypeScript, NestJS, Express.js.
  • test - to test all the features.
  • .env.example - a sample of .env which can be helpful for configuration.
# architecture
# deep drive in src directory

src/
├── todo/
│   ├── dto/
│   │   ├── todo.dto.ts
│   │   └── index.ts
│   │
│   ├── schemas/
│   │   └── todo.schema.ts
│   │
│   ├── todo.controller.ts
│   ├── todo.module.ts
│   └── todo.service.ts
│
├── app.module.ts
└── main.ts

Installation and Configuration

Let's move to the cloned directory with your terminal.

To install, build, and start the application for the first time, run the following commands:

npm install

Let's rename from .env.example to .env and make sure all the necessary information is correct:

PORT=3000

MONGODB_URI=<MongoDB_ATLAS_URI_HERE_PLEASE>
FRONTEND_URL=<FRONTEND_WEB_APP_URL_HERE_PLEASE>

Already done? Cool! You are almost ready to enjoy the app. ⛳️

Build & Run:

npm run start

Test:

Oh! You wanna trigger testing for the application from terminal

# e2e tests
npm run test:e2e

🥇 Congrats!! You are good to go

🧑‍💻 Stay in touch

🎉🎉 tada! 🎉🎉