code-challenge
code-challenge copied to clipboard
Submission to Implement Frontend for usaddress API call
Overview
This pull links the form template front-end to the API for parsing addresses.
Also, closes #38.
Demo
On success, a table is populated with the information:
On failure, an alert is generated and the table is cleared:
Notes
Note that the url is currently hard-coded into parserator_web/static/js/index.js as localhost:8000.
Http responses other than 200 (success) and 400 (parse failure) are not handled.
No text processing was done on the field names of the addresses, so they are still in CamelCase, which isn't particularly user friendly for a front end.
Testing Instructions
- docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app
- Successful case:
123 main st chicago ilreturns status code 200 and json:
{"address_components": [["AddressNumber", "123"],
["StreetName", "main"],
["StreetNamePostType", "st"],
["PlaceName", "chicago"],
["StateName", "il"]],
"address_type": "Street Address",
"input_string": "123 main st chicago il"}
- Unsuccessful case
123 main st chicago il 123 main streturns status code 400 and json:
{"error": "This address failed to parse"}