loopbackio / loopbackio/loopback-next
Prisma Integration
@achrinza ci sta già lavorando.
Dal 20/2/2021.
- Lingua principale
- TypeScript
- Stelle
- 5.1k
- Fork
- 1.1k
- Merge medio
- 2g 21h
- PR unite (30g)
- 27
Descrizione
This issue is for sharing thoughts on using prisma with loopback 4.
I wrote a simple example using prisma with loopback 4 and below are my initial observations.
-
Prisma does not work well with repositories, datasources or modals. The main reason for this is because prisma modals are tightly coupled with prisma datasources. This creates real friction with repositories, since repositories depend on a modal and datasource. I found it made the most sense to just directly use prisma in my controllers. The downside to this is that you cannot create loopback repository relationships with prisma data. Honestly though, that responsibility probably should lie with prisma anyways if you choose to use it.
-
The prisma api gets generated from prisma modals, which I find a bit awkward, although I understand it makes it easier to deal with the types. This will create challenges with loopbacks type system because loopback will be unaware of prisma types. This might be able to be improved with some hackery.
You can look at my example below.
https://github.com/codejamninja/lb4-prisma/blob/master/example/src/controllers/user.controller.ts
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.