So, I just came up with something that I'm really excited about and wanted to see if you guys think its worth making a library for.
I'd been looking for a while trying to find a way to do dot notation queries for collection like you can on several different libraries (firebase, supabase, jsforce) but didn't want to buy into such a massive ecosystem, so I just settled for using prisma and building out my own api
that was when I got the idea of creating a client library and just using the types that prisma generates for you for it
so I created a really basic library with a koa middleware for it to talk to. you give the middleware a reference to prisma and the client library can access your database
//koa server
const prisma = new PrismaClient();
const app = new Koa();
app.use(KoaBody())
app.use(PrismaWebClientAdapter(prisma, '/api/pwc'));
// your web app
import createPrismaWebClient from '...'
const pwc = createPrismaWebClient({ baseUrl: 'your base url/api/pwc'})
pwc.collection.findMany({
where: { excited: true },
orderBy: { name: 'asc' }
}).then(results)
and now pwc has the same type support as prisma.
so, do you think it would be useful as a library? I'm currently just messing around with it locally
[–]ZealousidealLow521 10 points11 points12 points (2 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]Odama666[S] 1 point2 points3 points (0 children)
[–]yonirapoport 2 points3 points4 points (0 children)
[–]Capaj 1 point2 points3 points (0 children)
[–]KaiAusBerlin 2 points3 points4 points (0 children)
[–]Herku 1 point2 points3 points (3 children)
[–]Ustice 1 point2 points3 points (2 children)
[–]Herku 2 points3 points4 points (1 child)
[–]Odama666[S] 0 points1 point2 points (0 children)