After git clone this code, please install the dependencies first:
yarn install
OR
npm install
You can run the Python server with the command in Python3:
python main.py
This requires Python 3 and the bottle library, I've included bottle with this project so you should not need to download anything other than Python 3.
The server will listen for requests on http://localhost:8010.
The main page of the application is generated by the Python code from the file index.html
in the views
folder. You can edit this file to add anything you need to implement
your application. If you rename the file, the server won't know where to find it, so don't.
Static files are served from the static
folder. You will see sub-folders for CSS, Javascript
and images. If you want to refer to one of these files in your HTML, use a URL
like /static/js/main.js
or /static/css/style.css
. The leading /
is important. You can
add any other sub-folders you might want under the static
folder and it will be served
by the application.
main.js
is the main entry point and is referenced from theindex.html
filemodel.js
contains the outline of the Model object and the required methods that you must implementutil.js
provides a utility functionviews.js
is empty for you to add your view functions to
The cypress
directory contains tests to be run with the Cypress testing tool.
The Python API server provides the following URLs serving JSON data:
/api/users
- GET returns a JSON array of user details/api/users/<id>
- GET returns details of an individual user/api/observations
- GET returns a JSON array of observation records/api/observations
- POST adds a new observation record (required fields below)/api/observations/<id>
- GET returns details of an individual observation/api/reset
- GET request resets the database (for testing purposes)