Skip to content

BaseCampCoding/autocomplete-from-api

Repository files navigation

Autocomplete from API

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 a GET request and provide a q argument for the current value of #student-name
  • /api/students will respond with JSON containing a single property students. The students 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 for q.
  • populate the #student-names datalist with options for each of the returned names. Don't forget to empty the datalist out first.

Important documation

Running the server

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

Running the test

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

About

Assignment to practice fetching data from an API endpoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published