The Humidity and temperature sensors app
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" localhost:3000/api/humidity
{"value":65}
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" localhost:3000/api/temperature
{"value":24.50}
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" localhost:3000/api/lamp
{"value":"off"}
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" -X PUT -d '' localhost:3000/api/lamp/on
{"value":"on"}
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" -X PUT -d '' localhost:3000/api/lamp/off
{"value":"off"}
$ curl -H "Accept: application/json" -H "X-Sensor: fake" -H "X-Token: team_a" -X PUT -d '' localhost:3000/api/lamp/color/240/65/36
{"value":[240,65,36]}
For starting up on the pi without a real webserver, you need to start as follows:
export RAILS_SERVE_STATIC_FILES=true
export RAILS_ENV=production
export SECRET_KEY_BASE=$( rails secret )
rails s