Converting Util Functions to api routes (app router)
Unanswered
Small Münsterländer posted this in #help-forum
Small MünsterländerOP
So i've been using prisma and nextjs:
Problem is, I started creating API functions using the code structure above.
Is there any way to optimize it? Am I doing it wrong?
export const getMatchesCount = cache(async ({ p_id }: { p_id: any }) => {
let count = await prisma.matches.count({
where: {
OR: [
{ winner_local_id: p_id },
{ loser_local_id: p_id },
],
},
});
return { matchesCount: count };
})Problem is, I started creating API functions using the code structure above.
Is there any way to optimize it? Am I doing it wrong?