While developing locally, I want to be able to simulate API calls to a FirebaseDB instance. I've had some success using json-server, primarily with GETs. However, the schema required by json-server is more array-based while Firebase is happier with objects (key, value pair structure). Any tips? Ideas? Thoughts?
Calvin Koepke
Software engineer specializing in headless WordPress.
Calvin Koepke
Software engineer specializing in headless WordPress.
Depending on the size of your API, you could just create your own JSON file with mock data to simulate the call. Since Firebase is just and object-structure, re-implementing that should be fairly straight-forward.
If you need to simulate authentication, then that's different and I'm not sure how to do that locally. If not, though, this should be sufficient for testing async/await, or whatever it is you are trying to practice.
Fetching your local API file should be the same as fetching an external source. If you want to simulate a slow connection, throttle your connection speed using Chrome Dev Tools.
I'm pretty sure you can even target specific requests and throttle those as well.
Not sure if this is what you're looking for, but hope it helps!