Newer
Older
# Skeleton Web App
## Overview
This module implements a skeleton Flask-based webservice.
The webservice is communicates with clients over HTTP.
Responses to valid requests are returned as JSON messages.
The server will therefore return an error unless
`application/json` is in the `Accept` request header field.
HTTP communication and JSON grammar details are
beyond the scope of this document.
Please refer to [RFC 2616](https://tools.ietf.org/html/rfc2616)
and www.json.org for more details.
## Configuration
This app allows specification of a few
example configuration parameters. These
parameters should stored in a file formatted
similarly to `config.json.example`, and the name
of this file should be stored in the environment
variable `CONFIG_FILENAME` when running the service.
## Running this module
This module has been tested in the following execution environments:
- As an embedded Flask application.
For example, the application could be launched as follows:
```bash
$ export FLASK_APP=app.py
$ export CONFIG_FILENAME=config.json
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$ flask run
```
- As an Apache/`mod_wsgi` service.
- Details of Apache and `mod_wsgi`
configuration are beyond the scope of this document.
- As a `gunicorn` wsgi service.
- Details of `gunicorn` configuration are
beyond the scope of this document.
## Protocol Specification
The following resources can be requested from the webservice.
### resources
Any non-empty responses are JSON formatted messages.
#### /data/version
* /version
The response will be an object
containing the module and protocol versions of the
running server and will be formatted as follows:
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"api": {
"type": "string",
"pattern": r'\d+\.\d+'
},
"module": {
"type": "string",
"pattern": r'\d+\.\d+'
}
},
"required": ["api", "module"],
"additionalProperties": False
}
```
#### /test/test1
The response will be some json data, as an example ...