3 ms·
Ask HN: How would you implement a test-mode for an API?
Looking to implement something similar to what Stripe has for their API (live/test API keys), but haven't decided on a solid direction to take yet. Curious as to how others would approach this type of feature.
* Would you use a scope via an attribute on the model?
* Would you use a separate Postgres schema for test-mode requests?
* Maybe even a separate database?
- whatnotests 10y agoMake it a completely separate stack. * Authentication / API Keys * Servers * Schema * etc Also, don't make the mistake some others do, by making it your testing environment as well. Instead, consider this environment a "Sandbox Environment" which has the same SLA as your production environment.
- amacalac 10y ago* I would use an ACL on test keys * I'd use the same schema * I'd use a separate database. You want test mode to 100% replicate production mode, but you never want test data to contaminate your production data
- ezekg 10y agoGreat point about not contaminating production data. And just to clarify, ACL = access control list?