📜 To run TestAPI on your computer and check how your questions look like, then you'll need to install it first :
requirements.txt file._courses.json file in the API code folder :{
"courseID": "/path/to/your/database/folder"
}
Here the courseID will be used by the API to generate the website for your course, so you can use any short URL-safe name that you want (for instance, prozprog, analysis-I, ...). Also, replace the "/path/to/your/database/folder" by the full path of your database folder (no relative path !).
⚠️ If there is no
_courses.jsonfile provided, or if the format is not correct, then the API won't be able to start.
Finally to run the program, just open a terminal and execute :
uvicorn main:app
$\Rightarrow$ you'll see in the terminal a message of this form :
INFO: Started server process [31520]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
... which basically indicates that you can open the API with the following link on your favorite browser : http://127.0.0.1:8000.
Then you can add questions, modify some, ... and see live the changes on the API
😇 You may realize now that this works only for Unix-based systems (Linux, Mac, ...). If you are using Windows (and cannot use anything else), please open an issue to ask for this specific support.
🔔 Note
If you want to develop multiple question database and use it within your TestAPI installation, just add those in the _courses.json file like this :
{
"courseA": "/path/to/your/courseA/database",
"courseB": "/path/to/your/courseB/database",
"otherCourse": "..."
}
💡 Hint for developers
If you want to add some changes on the API code, you can use this command :
uvicorn main:app --reload
which will run a development server updating the website each time it detects a change in the code.
⚠️ If you change the css styles in the
cssfolder, then you'll have to restart theuvicornserver for those changes to be taken into account.