fixed api problems

This commit is contained in:
Senad Uka
2016-02-14 16:34:11 +01:00
parent e985699645
commit a43099adf3
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
// Global API configuration
var Api = new Restivus({
version: 'v1.0',
useDefaultAuth: true,
prettyJson: true
});
@@ -8,6 +9,7 @@ Api.addRoute('sensorData', {
authRequired: false
}, {
post: function() {
console.log("Body params", this.bodyParams);
SensorData.insert({
temperatureValue: parseFloat(this.bodyParams.temperatureValue),
humidityValue: parseFloat(this.bodyParams.humidityValue),

View File

@@ -1,9 +1,9 @@
GPIO_PIN_DHT = 4 # BCM
SENSORDATA_URL = 'http://tfm.meteor.com/api/sensorData'
SENSORDATA_URL = 'http://tfm.meteor.com/api/v1.0/sensorData'
GPIO_PIN_TANKFULL = 20 # BCM
GPIO_PIN_VALVE = 21 # BCM
API_BASE_URL = 'http://tfm.meteor.com/api'
API_BASE_URL = 'http://tfm.meteor.com/api/v1.0'
CONTROLLER_ID = '120' # every controller must have a different one
STATE_FILE = '/var/run/controller_state'