2

I am building a project where I have 2 approaches to follow -

Either I can create APIs for all operations and call them from my frontend which can be in Angular.

Or I can use normal Django views and template.

Question: what is the best approach to follow and what is the performance impact of them?

Adi81027
  • 61
  • 6

2 Answers2

1

Go for Rest API, that will make your life easy if you have plans to integrate that with other Applications (e.g. May be you would like to create Mobile App in future)

Sopan
  • 644
  • 7
  • 13
  • Performance - it should not have any difference. REST API will more generic way of developing your application. You can integrate your Web Application with front-end technologies like Vuejs or Angular in more generic way than yourself fighting with each url, each template etc. – Sopan Aug 21 '18 at 09:07
0

There are many factors, that play into this, however if you already have a front-end built with Angular, there is a strong case to be made for the approach of using a Django Rest Framework-based API. Some advantages are:

  1. Encapsulation facilitates testing.
  2. API resources are reusable, should you need similiar functionality in some other appliication or front-end
  3. If you seperate these components you can more easily change either one or the other, if your requirements change in the future.

I would go with the API…

fujy
  • 5,168
  • 5
  • 31
  • 50
MTTI
  • 391
  • 2
  • 10