An HTCPCP/1.0 server over HTTP implemented in Scala with http4s.
- Methods:
BREW,GET,PROPFIND,WHEN, plusHEADandOPTIONS - Resources: Coffee pots as URIs, e.g.
/pot-1,/pot-2; teapots as/teapot-*(return 418 for coffee) - Status codes: 200, 202, 400, 404, 406, 418, 500 as appropriate
- Content types:
message/coffeepot,application/coffee-pot-command,application/jsonfor BREW body
sbt runServer listens on 0.0.0.0:8080. Main class: htcpcp.HtcpcpServer.
sbt testList all pots
curl -s http://localhost:8080/
curl -s http://localhost:8080/potsStart brewing (message/coffeepot)
curl -i -X BREW http://localhost:8080/pot-1 \
-H "Content-Type: message/coffeepot" \
-d "start"Start brewing (JSON)
curl -i -X BREW http://localhost:8080/pot-1 \
-H "Content-Type: application/json" \
-d '{"beverage":"coffee","strength":"normal","additives":[]}'Get pot status
curl -s http://localhost:8080/pot-1PROPFIND (capabilities)
curl -s -X PROPFIND http://localhost:8080/pot-1Schedule brew (WHEN)
curl -i -X WHEN http://localhost:8080/pot-1 -d "2025-02-06T08:00:00Z"418 I'm a teapot (brew coffee on a teapot)
curl -i -X BREW http://localhost:8080/teapot-1 \
-H "Content-Type: message/coffeepot" \
-d "start"- Scala 3.3
- http4s 0.23 (Ember server)
- Circe (JSON)
- Cats Effect 3 (IO)
- ip4s (host/port literals)
See LICENSE.