vendredi 9 décembre 2022

NextJS using Django API - How to choose best pattern

I have GeoDjango running on a digital ocean droplet and I'm rewriting project from VueJs to NextJs hosted on Vercel.

In Vue we have service pattern connected with store that is responsible for fetching and updating data.

I figured out the fetching part which is quite good but I'm still trying to figure out the best way to update data.

How should I construct the CRUD layer without using the NextJs API folder ( I don't want to have another backend calling my Django backend).

Should I use context?

Should I use middleware?

Should I create custom services? How to call them then? Is there an equivalent of store in NextJs?

I'm asking because I want to avoid cluttering as right now I'm using fetch POST on pages. I'm using NextAuth that gives me a context with jwt token.

Thank you for any hints

Aucun commentaire:

Enregistrer un commentaire