dev-mastery / comments-api

MIT License
1.92k stars 649 forks source link

What's the point #52

Closed wlopez-enkoding closed 3 years ago

wlopez-enkoding commented 3 years ago

https://github.com/dev-mastery/comments-api/blob/a4e718941a32f28fae55c2ee630f85ae73d3be11/src/data-access/comments-db.js#L17

Hi man, first of all: thank you for your contribution for the community !

I was looking at this piece of code, and I don't understand why you import the DB and inside this code you use logic technology-specific... what's the point ?

I mean... If I need to change the data base I need to change makeDb origin, and ALSO this technology specific logic.

Am I right?

Thanks !

nivb52 commented 3 years ago

You can easily use a proxy to implement an adapter pattern to those changes. You can also use tools such which make the getting into the DB very similar to all query languages, such as NanoSql and even Prisma , making your changes minimal.

wlopez-enkoding commented 3 years ago

You can easily use a proxy to implement an adapter pattern to those changes. You can also use tools such which make the getting into the DB very similar to all query languages, such as NanoSql and even Prisma , making your changes minimal.

Woooow both options look amazing ! Thank you !