Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chubi-x/bookmarks-api
Create, update, and delete browser bookmarks as an authenticated user
https://github.com/chubi-x/bookmarks-api
dependency-injection expressjs nestjs nodejs postgresql prisma typescript
Last synced: 1 day ago
JSON representation
Create, update, and delete browser bookmarks as an authenticated user
- Host: GitHub
- URL: https://github.com/chubi-x/bookmarks-api
- Owner: chubi-x
- Created: 2022-06-28T22:30:56.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-15T17:30:31.000Z (over 2 years ago)
- Last Synced: 2023-03-04T19:27:21.979Z (over 1 year ago)
- Topics: dependency-injection, expressjs, nestjs, nodejs, postgresql, prisma, typescript
- Language: TypeScript
- Homepage:
- Size: 260 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bookmarks API π
## Tools βοΈ
- Built on Express and Node with NestJs π¦
- Data stored on POSTGRES DB π running on Docker π³
- ORM schema and db manipulation with Prisma πΌ
- API testing with Postmanπ¨πΎβπ, Pactum, and Jest π
- Authentication with JWT and Passport π
- Input validation and transformation with Class (transformer + validator) libraries β##FunctionalityβοΈ
- sign up and login as a user
- create, edit, retrieve, and delete bookmarks
- protected routing such that only authenticated and authorized users can manipulate bookmarks
- input validation using DTOs to ensure only expected data is accepted to the server## Motivations and Thoughts πͺπΎπ
I built this API to give myself a little refresher in backend dev cause its been ages!
Nest made my life so easy with its robust library of tools. I liked how it helped me modularize my code with its concept of modules, controllers, and services. It helps you keep your code clean by relegating business logic to the service and routing to the controller, using dependency injection to make services available to other modules. I also loved its decorator feature that helps you easily define and handle http routes and (Req,Res) parameters. This feature reminded me a lot of Java π.
Nest's Validation Pipes made input validation a breeze, providing security and an intuitive way to ensure I was only handling data I was expecting (goodbye Injection attacksπ). No more racking my brain figuring out how to make sure a user could only send an Int as their phone number lol.However, out of all these amazing features, Nests's custom decorator was the one that blew me away. Its a powerful feature that lets you create YOUR OWN DECORATORS, giving you access to the Req and Res objects and even letting you parse data from them! All I had to do was use its Execution Context interface to retrieve the request and I could get access to my user's request data from any module at all! How cool is that?!
Nest's awesome features let me structure my code, making it super easy to find and squash bugs πͺ³ and giving me freedom to do what we all love to do, build stuff. It abstracts away all of Express's excesses (lol rhyme) and makes it a joy to write server side logic. I'll definitely be using this framework more in the future!