Example applicationΒΆ
First install Invenio-REST, setup the application and load fixture data by running:
$ pip install -e .[all]
$ cd examples
$ ./app-setup.sh
$ ./app-fixtures.sh
Next, start the development server:
$ export FLASK_APP=app.py FLASK_DEBUG=1
$ flask run
and use cURL to explore the simplistic REST API:
$ curl -v -XGET http://0.0.0.0:5000/records/
$ curl -v -XGET http://0.0.0.0:5000/records/ \\
-H Accept:application/xml
The example app demonstrates:
- Use of
Accept
headers to change the serialization from JSON to XML via theinvenio_rest.views.ContentNegotiatedMethodView
. - CORS headers (
Access-Control-Allow-Origin
andAccess-Control-Expose-Headers
).
To reset the example application run:
$ ./app-teardown.sh