RESTful Routing with Express.js and TypeScript in 60 Seconds #shorts #webdevelopment

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Nice, 👍

1- It's better to keep your routes in a separate file, such as "JobRoutes.js, " rather than in the entry point file. This will make the code easier to maintain.

2- Avoid implementing logic directly within the routes. Instead, place that logic inside a controller class, and have the routes call the appropriate methods from the controller.

3- To interact with the database, you should use a DAO (Data Access Object) design pattern. The methods in the controller class (as mentioned in point 2) should call the corresponding functions in the DAO class.

This separation of concerns greatly improves the maintainability of your code in the long run.

الشافعيمذهباالإسحاقينسباالصوما
Автор

And you use Xata!!! I’ve been falling in love with the workflow of xata… so much easier!

PrisonYT
Автор

Good one! One thing I noted in Express is that you don't have to type out request and response in Express. It implicitly types it out.

Also passing the id, express detects it too

MaxProgramming
Автор

Can you share your vs code theme name?

kingslayerabirrion
Автор

How do ypu structure your express projects

omomer