I have this application containing 2 parts:
- User-facing SPA web served by Apache
- NodeJS API server
When a user go to the SPA web, Apache will do authentication and prefetch data for that user by making a POST and a GET request to the API before serving the page. This works fine for normal days, but it is pretty slow when there is a lot of traffic.
Apart from improving the API, I think delegating authentication and data fetching to client-side would improve performance.
My questions are:
- Does prefetch data by Apache before serving the SPA page hurt performance?
- And would it be better to let client-side does the fetching?