1

I'm not sure what might go wrong when I have to integrate a django API (built using JsonResponse and without extra frameworks) with a frontend, in this case, Next.js.

I built a django API using JsonResponse (void of DRF). I want to build a frontend client with Next.js that would make API calls to my django API. My questions are:

  • Will I have to run both django and next.js servers at the same time to execute the full project?
  • I think I would face some challenge with csrf token, what other challenges may I face having built my API without an API framework as Django Rest Framework?

1 Answers1

0
  1. It is almost always a better approach to treat these two as separated as possible. I'd go with completely separate repos, hosting etc...

  2. I think the biggest advantage of using DRF is the validation. DRF has nice ways to handle request data validation. Your views will look much leaner, because it will save you the trouble of writing much boilerplate code.

Jovan V
  • 130
  • 7
  • Yeah, but I wrote most of those boilerplate codes already. As I stated in my question, I built the API using JsonResponse. I do not want to undo my work and rebuild with DRF if I could accomodate the cons. Thus, I need to know what the downsides maybe. – Praise Olusomiji Nov 16 '22 at 20:07
  • In that case maybe go ahead without DRF. At the end of the day, a framework offers just convenience. But keep in mind that if you plan on scaling, you will have to write the boilerplate over and over again. Other than that, I don't really think there are any other serious downsides to skipping DRF. – Jovan V Nov 17 '22 at 08:54