dssg / matching-tool

Integrating HMIS and criminal-justice data
Other
7 stars 7 forks source link

Enable faster frontend development using mock API #349

Open thcrock opened 6 years ago

thcrock commented 6 years ago

For frontend developers looking to improve the app, it's helpful to not have to run the Python code, both for setup simplicity and a fast feedback loop. Mock APIs are common.

We have some data that can be used to create a mock API (for the results page, at least), in webapp/sample_data/results_input: https://github.com/dssg/matching-tool/tree/master/webapp/sample_data/results_input

This data is used by backend unit tests as a gold standard for the data that the results endpoint must produce: https://github.com/dssg/matching-tool/blob/master/webapp/webapp/tests/test_endpoints.py

And also so far by the frontend action creator unit tests as an interface that they should expect. https://github.com/dssg/matching-tool/blob/master/webapp/frontend/__tests__/actions.js#L67

This should be enough as the basis for a mock API that enables development of the results page without running the whole webapp.

Options for implementing the mock API server include:

  1. An NPM library like https://github.com/typicode/json-server
  2. The existing Flask, but in some mode that allows the endpoints to be replaced with static versions