Skip to content

sundae-party/api-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-server

Build Status

Build

Build all the api-server

make

Test

The default docker bridge network never supported service discovery through a built in DNS. Create new custom network to enable that, or address db container with container ip ...

docker network create sundae

Create new mongo for the tests:

docker run \
    --rm -it --name mongo-test \
    -p 27018:27017 \
    -e MONGO_INITDB_ROOT_USERNAME=admin \
    -e MONGO_INITDB_ROOT_PASSWORD=pwd \
    -e MONGO_INITDB_DATABASE=sundae \
    -v $PWD/init_mongo_test.js:/docker-entrypoint-initdb.d/init_mongo_test.js \
    mongo --replSet rs0

Run the tests, if custom network was created for db container add the dev container in this same docker network.

make go_test

API test

curl create / update integration

curl -X POST -H "Content-Type: application/json" \
    --cacert ca.pem \
    --key cli.key \
    --cert cli.pem \
    -d '{"name": "Hue", "documentation": "https://sundae/doc/hue", "version": "v1.0.1", "url": "https://github.com/sundae-party/integration/hue"}' \
    https://localhost/api/integration
curl -X POST -H "Content-Type: application/json" \
    --cacert ca.pem \
    --key cli.key \
    --cert cli.pem \
    -d '{ "name" : "corridor-sdb_dimmer", "integration" : { "name" : "MQTT" }, "desiredstate" : { "brightness" : 0} }'\
    https://localhost/api/light/desiredstate

About

The Sundae api-server component.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published