
Stop Mocking Everything: A Better Way to Develop Frontends with Real APIs
As frontend developers, we’ve all faced this situation: Backend is not ready You need to test error states but cannot trigger them You mock everything, and then nothing matches production So you end up choosing between: Mock everything (fast but unrealistic) Use real APIs (accurate but limited) What if you did not have to choose? Meet local-proxy I built a small tool to solve this problem: Mock only what you need. Use the real API for everything else. GitHub: https://github.com/BoumouzounaBrahimVall/local-proxy Example: https://boumouzounabrahimvall.github.io/local-proxy/example/ Article: https://brahim-vall-boumouzouna.up.railway.app/posts/local-proxy/ The idea Instead of replacing your backend, you place a proxy in front of it: Your App → local-proxy → Real API │ (intercepts some calls) If a request matches a rule, it returns a mock Otherwise, it forwards the request to the real backend Why this approach works Partial mocking Mock only the endpoints you care about: { "method" : "POST
Continue reading on Dev.to Webdev
Opens in a new tab

