A simple Todo Application with NestJS, TypeORM, PostgreSQL, Swagger, PGadmin4, JWT, and Docker (Part 2)

N.B. Please finish the Part-1 first to understand rest of the tutorial

So our authentication is working properly. Let’s update a user’s profile by hitting /api/user — PATCH method. On successful update, you should able to see the below image-

To view the user information, use api/user — GET method & your screen will be -

Step 11: Let’s enhance the Todo module by creating folders & files-

...
- todo
- dto
- todo.dto.ts
- repository
- todo.repository.ts
- service
- todo.service.ts
- todo.controller.ts
...

todo.controller.ts, todo.dto.ts, todo.repository.ts & todo.service.ts files.

And update your todo.module.ts file -

N.B. It is better to execute docker-compose down before running that container. Because, it will remove the containers for services defined in the compose file & networks as well.

Now run the docker environment again — docker-compose up. Get authenticate using swagger & create a todo for that authenticated user. API /api/todo — POST method.

Now try the rest of the APIs of todo by yourself (GET, DELETE, PATCH).

So.. you have just finished the complete NestJS application under the docker environment. Play with it & try to add more features to it.

One last thing, If anyone wants to run without a docker environment then create a config folder on the project root. Like-

- config
- default.yml
- development.yml
...

Update default.yml, development.yml & typeorm.config.ts file-

And execute the below commands.

npm run typeorm:generate AnyNameYouLike
npm run typeorm:run
npm run start:dev

N.B. Please be make sure that you have postgres on your machine.

That’s all. You have just finished the complete guide of NestJS under the docker environment. If you find this article helpful then please put your appreciation with a clap. Stay safe Stay cool. To get the complete code — GitHub.
Sayonara !!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tushar Roy Chowdhury

Tushar Roy Chowdhury

63 Followers

I am a passionate programmer and always keep eye on new technologies and scrutinize them until getting into shape.