dimanche 17 mai 2020

How to design APIs for Single Page Application

We are working on a single page application where our first load will be server render and subsequent pages will render using APIs.

Current Structure:

1. We are maintaining different backend for each page

We have common slug and page-specific slug across the site.

Now we having a debate on how to create APIs. So we have stuck at two points.

  1. Should we create generic APIs for each slug?

Example: If Page is compare page and that containing specs, colors and newsslug then API will be like /api/spec/, api/colors/, /api/news/

  1. Should we create different API for each page(complete JSON which is need for a single page)?

Example: If Page is compare page then API will be like /api/comparepage/

Question:

What is the right approach and Why?

Aucun commentaire:

Enregistrer un commentaire