Enable faster frontend development using mock API
- Dominant language
- Python
- Stars
- 7
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
Research direction
Start with webapp/sample_data/results_input, the results endpoint expectations in webapp/webapp/tests/test_endpoints.py, and the frontend action creator tests at webapp/frontend/__tests__/actions.js. Compare the available Flask and NPM-library approaches, then verify that the results page can use a static mock API without running the Python application and that the existing frontend expectations remain satisfied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, javascript, python
- Domain
- api, backend, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100