For this assignment you will be using the JavaScript function fetch
to make an API request to the backend and update a datalist
to support
dynamic autocompletion based on data from the server.
To complete this project you will want to:
- listen to
input
events on the#student-name
input
fetch
to/api/students
with aGET
request and provide aq
argument for the current value of#student-name
/api/students
will respond with JSON containing a single propertystudents
. Thestudents
property will be associated with an array of strings. Each string is the name of a BCCA student/graduate whose name contains the value provided forq
.- populate the
#student-names
datalist
withoption
s for each of the returned names. Don't forget to empty thedatalist
out first.
This project doesn't require a database, so you don't have to do any interesting setup. Just run the server!
python3 manage.py runserver
This project uses a cypress test suite.
You should npm install
to make sure cypress
gets installed.
After that you can run npm test
to start the cypress
test runner.
From there you can press the Run All Specs
button.
Don't forget to start your django server before running your cypress specs