diff --git a/Changelog.md b/Changelog.md index c2e853a..7a79c6f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +# v0.9.1 - 16th May 2019 + - [API] Changed the default action. It now displays a helpful message by default instead of routing directly to `fetch-data`. + # v0.9 - 9th May 2019 - Add heatmap gauge at the right-hand-side - Display the changelog the first time a user loads the page after an update diff --git a/docs/05-API-Docs.md b/docs/05-API-Docs.md index 0b792bf..36f9b81 100644 --- a/docs/05-API-Docs.md +++ b/docs/05-API-Docs.md @@ -1,5 +1,7 @@ # API -The server-side API is accessed through `api.php`, and supports a number of GET parameters. The most important of these is the `action` parameter, Which determines what the API will do. The following values are supported: +The server-side API is accessed through `api.php`, and supports a number of GET parameters. On the main production instance, this can be found [here](https://aq.connectedhumber.org/api.php). + +The most important of these is the `action` parameter, Which determines what the API will do. The following values are supported: ## version > Returns the version of the application. diff --git a/logic/Actions/Index.php b/logic/Actions/Index.php new file mode 100644 index 0000000..b5838ba --- /dev/null +++ b/logic/Actions/Index.php @@ -0,0 +1,45 @@ +settings = $in_settings; + } + + public function handle() : bool { + global $start_time; + + $start_handle = microtime(true); + + + // 1: Parse markdown + $result = "Welcome to the Air Quality Web HTTP API! + +Although the web interface is the default thing you see, it actually uses this HTTP API as a backend - which can be interacted with directly. + +Official usage documentation for the latest version of the API can be found here: https://aq.connectedhumber.org/__nightdocs/05-API-Docs.html + +Note that if you have deployed your own version of the air quality web interface, you will need to ensure you're up-to-date with the latest commits in the \"master\" branch, otherwise the HTTP API documentation may not be completely accurate with respect to the version you're running. +"; + + + // 2: Send response + header("content-length: " . strlen($result)); + header("content-type: text/plain"); + header("x-time-taken: " . PerfFormatter::format_perf_data($start_time, $start_handle, null)); + echo($result); + return true; + } +} diff --git a/package.json b/package.json index 565a602..5e46503 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "air-quality-mapper", - "version": "0.1.0", + "version": "0.9.1", "description": "The web interface and JSON api for the ConnectedHumber Air Quality Monitoring Project.", "private": true, "main": "index.mjs", diff --git a/settings.default.toml b/settings.default.toml index 9c3f562..9a71230 100644 --- a/settings.default.toml +++ b/settings.default.toml @@ -26,7 +26,7 @@ password = "Define_in_custom_config_file" # Settings that control the router's behaviour # The default action to take if no action is specified -default-action = "fetch-data" +default-action = "index" [cache] # Settings that control how we request that appropriate API responses be cached. diff --git a/version b/version index 1bd5ffe..e6e6db4 100644 --- a/version +++ b/version @@ -1 +1 @@ -v0.9.1 +v0.9.2