/heliopause

🚀 a space api microservice

Primary LanguageJavaScriptMIT LicenseMIT

heliopause

🚀 a space api microservice

build status

heliopause editor screenshot

Editor

An Editor for easy editing is provided on /editor.

Door Widget

A widget for displaying the door status is provided on /door.

Api

GET '/'

Get space api data.


POST '/'

Post new api data. Returns the new api state on success. An authentication token is needed.

{
  "api": {
    "space": "Chaostreff Flensburg"
    //...
  },
  "token": "your-api-token"
}

POST '/door'

An endpoint to post new door status through url-queries. An authentication token is needed.

$ curl --request POST http://localhost:3000/door?open=true&token=your-token

POST '/token'

Create a new authentication token. Returns the new token on success. An authentication token is needed.

{
  "token": "your-api-token"
}

A token can also be created with the TOKEN env-variable on startup.

$ TOKEN=your-token npm start

Deployment

As a node.js Project

Clone the repo and follow the build instructions under Build Setup.
A node.js version of 10.4 or higher is needed. Older versions may work, but are not tested.

Data Migration

Older databases can be migrated by simply copying the *.db files from the ./data directory.

Docker

$ docker run -d --name heliopause -p 8080:80 -v ./data:/app/data roikiermedia/heliopause

An example docker-compose.yml is also provided.

Data Migration

If the same host volume is used, the data will be persisted automatically.

Development

Build Setup

# install dependencies
$ npm install # Or yarn install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm start

When started with npm run dev an authentication token dev is created.

Code Style

This project uses Prettier to format code. Prettier should be run before creating a pull request. You can run it with the default settings from your editor. For more information, refer to the official documentation.

Frameworks

Next.js

For detailed explanation on how things work, checkout the Next.js docs.

Attribution

SpaceAPI Logo & Avatar by Sebastian Morr are licensed under CC-BY-SA 4.0


Made with ♡ at Chaostreff Flensburg | CI & CD | License