vendredi 20 décembre 2019

Where to place static files (index.html, etc)

When you have an SPA (Angular) front-end and an API server (Node, Nestjs) that only handles API requests, what is the best practice for the static files' locations? I use NGINX with most projects, so I like to let NGINX handle the static files (.js, .css, .jpg, etc.).

Would you:

  1. After client build, move files to the API server folder and let Node handle file requests;
  2. Let NGINX redirect to a dedicated static server (that also handles uploads/images etc.); or
  3. Let NGINX route to the ./client/dist folder and serve from there.

I'd prefer to let NGINX redirect to CDN server that has all 'client' files (index.html, .js, .css, images etc), so API server does API -> DB stuff, and nothing more.




Aucun commentaire:

Enregistrer un commentaire