nghiavt2906 / Web-Scraping-BE

0 stars 0 forks source link

[Question] Why not using an ORM for database operations? #8

Closed olivierobert closed 1 year ago

olivierobert commented 1 year ago

Part of the assessment is reviewing which libraries and tools are used to build the application. Battle-tested solutions such as Express were used, but database operations are performed without any abstraction layer.

https://github.com/nghiavt2906/Web-Scraping-BE/blob/57c918214c75686543944fa0368f7b94fed78368/src/services/searchResults.js#L5-L13

Usually, most applications use an ORM such as Prisma (favorite at @nimblehq), Sequelize, or TypeORM to make database migrations and queries easier and bullet-proof.

nghiavt2906 commented 1 year ago

Actually I only wrote sql queries for testing the scraping bot at first and later implemented ORM (Prisma) on a different branch. I should have forgot to merge into the main branch somehow. Please have a look at my updated code. Sorry for the mistake.

olivierobert commented 1 year ago

The replacement with Prisma looks good 👍 Again nothing wrong using SQL queries per se, I wanted to understand better your reasons for doing so.