smart_garden_server/client/main.jsx

29 lines
829 B
JavaScript

import React from 'react';
import { Meteor } from 'meteor/meteor';
import ReactDOM from 'react-dom';
import App from '../imports/ui/App';
import 'bootstrap/dist/css/bootstrap.min.css';
export const PlantTypesCollection = new Meteor.Collection('plantTypes');
export const SensorDataCollection = new Meteor.Collection('sensorData');
Meteor.startup(() => {
if(Meteor.isServer) {
Meteor.publish('plantTypesCollection', function() {
return PlantTypesCollection.find();
})
Meteor.publish('sensorDataCollection', function() {
return SensorDataCollection.find();
})
}
if (Meteor.isClient) {
Meteor.subscribe('plantTypesCollection');
Meteor.subscribe('sensorDataCollection');
}
Meteor.setTimeout(function() {
ReactDOM.render(<App />, document.getElementById('root'));
}, 1250);
});