26 lines
563 B
JavaScript
26 lines
563 B
JavaScript
if (Meteor.isServer) {
|
|
Meteor.startup(function() {
|
|
// code to run on server at startup
|
|
});
|
|
|
|
// Global API configuration
|
|
var Api = new Restivus({
|
|
useDefaultAuth: true,
|
|
prettyJson: true
|
|
});
|
|
|
|
Api.addRoute('sensorData', {
|
|
authRequired: false
|
|
}, {
|
|
post: function() {
|
|
SensorData.insert({
|
|
temperatureValue: parseFloat(this.bodyParams.temperatureValue),
|
|
humidityValue: parseFloat(this.bodyParams.humidityValue),
|
|
owner: this.bodyParams.owner,
|
|
created_at: new Date()
|
|
});
|
|
return [];
|
|
}
|
|
});
|
|
}
|