All jobs / Full-stack developer / DevOps Basics
Full-stack developer interview question · 1–3 years
You are deploying a SPA and its API for the first time on the same domain.
How do you host them?
The strongest answer
Hashed static assets on a CDN, `index.html` with a short cache, API on its own origin or path, and a fallback so deep links do not 404 on refresh
Why it works
Exactly. The SPA refresh problem and the cache problem are deploy problems. Split asset cache from HTML; give the API a real origin.
What a good answer covers
- CDN for hashed JS/CSS; short TTL for HTML.
- API uncached or explicitly cached.
- Server fallback to `index.html` for client routes.
- Do not freeze HTML and API on the asset TTL.
Answers that fall short
- Close, but not the strongest: One Express process that serves the latest `index.html` and the API, cached for a week
A week-old `index.html` points at deleted JS hashes. That is a blank page. - Weak: Put the API behind the same long cache as the JS
Caching JSON the way you cache a bundle is how you serve yesterday's permissions. - Red flag: Require hash routes only (`/#/settings`) so the server never sees the path
Hash routes dodge refresh 404s and break every real URL you wanted to share.
Who gets asked this
More DevOps Basics questions
- How do you make it smaller, and what should not be in it at all?
- APM shows fast API spans. Users still wait two seconds after click. How do you see one click in the tracer?
- The pipeline builds the client three times, once per environment, because the API URL is baked in at build…
- A feature flag has been on for everyone for four months. Both code paths are still there. When is the flag…
- Every PR gets a preview URL. The default env still has the production API base. What must a preview deploy…
- Prod: 'submit does nothing'. API dashboards look calm. The SPA error rate ticked up after a mixed deploy…
- API 5xx is 0.1%. Users still report 'save failed' because the SPA cannot reach a new path. Which errors go in…
- Platform wants daily UI deploys and weekly API deploys from the same repo. When may UI and API ship on…