# SpaceAPI Server [![pipeline status](https://gitlab.com/s3lph/spaceapi-server/badges/master/pipeline.svg)][master] [![coverage report](https://gitlab.com/s3lph/spaceapi-server/badges/master/coverage.svg)][master] A lightweight server for [SpaceAPI][spaceapi] endpoints. Includes support for pluggable templating, so dynamic content, like sensor values, can be added. ## Dependencies - Python 3 (>=3.6) - [Bottle][pypi-bottle] - [Jinja2][pypi-jinja2] ## License [MIT License][mit] ## Introduction This project is an attempt to implement a lightweight, yet versatile SpaceAPI endpoint server. In its simplest configuration, it just serves a plain, static, boring JSON document. In order to provide dynamic content (e.g. whether your space is currently open), you can replace parts of the JSON document (anything except object keys) with [Jinja2 templates][jinja], from which you can invoke custom plugins, which look up and return your dynamic content.
Input | Output |
```json { "api": "0.13", "space": "My Hackerspace", "state": "{{ space_state() }}", "sensors": { "network_connections": "{{ network_connections() }}" } } ``` | ```json { "api": "0.13", "state": { "open": true, "lastchange": 1575160777, "message": "Visitors Welcome!" }, "sensors": { "network_connections": [ { "value": 4, "type": "wifi", "name": "2.4 GHz" }, { "value": 7, "type": "wifi", "name": "5 GHz" } ] } } ``` |