Built using Kotlin and KTOR because we felt it was sufficiently off flavor, but still resembling Java to the point where new IT-students would find it approachable.
There are two primary ways of starting the development build:
This assumes you have gradle version 5.0.0 or higher installed.
cd backend
gradle build
gradle shadowJar
gradle runShadow --args <insert hue API-key here>
This assumes you have docker installed, which can be installed using your package manager
cd backend
docker build . -t cthit/hueit-frontend:dev .
docker run -p 8080:8080 cthit/hueit-frontend:dev <insert hue API-key here>
The production build can be tested in a similar way:
cd frontend
docker build -t cthit/hueit-backend:latest .
docker run -p 8080:8080 cthit/hueit-backend:latest <insert hue API-key here>
There are two primary ways of using the development build:
Look at the readme in the frontend-folder for more info.
This assumes that you have something like curl or Insomnia installed.
By default the backend is opened on localhost:8080.
At the moment the HueIT-backend only accepts POST-requests and only to two routes: '/' if only affecting one lamp or group, and '/list' if affecting more than one lamp or group. The only difference in what JSON-objects they receive is that '/' accepts a singular so called 'RequestBody', while '/list' accepts JSON-object with one field called 'requestBodyList' which holds an array of RequestBodies.
A RequestBody consists of the following fields:
Send the following JSON-object to localhost:8080/ to turn on lamp 2 with a nice turquoise colour:
{
"isGroup": false,
"id": 2,
"props": {
"pwr": true,
"hue": 181,
"sat": 75,
"bri": 100
}
}
docker pull cthit/hueit-backend:latest