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:
- After client build, move files to the API server folder and let Node handle file requests;
- Let NGINX redirect to a dedicated static server (that also handles uploads/images etc.); or
- 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