Commit dde2f49d authored by David Haynes's avatar David Haynes

Massive cleanup & renaming & moving & removing

- stick close to the meteor file structure
- properly use client/server directories
- renaming files to better represent what they are
- more appropriate locations for things
- remove some dummy code (will be back soon)
parent 392f664c
<head>
<meta charset="utf-8">
<meta name="description" content="SRCT Weather beautifully displays live weather and forecasts for Mason's campuses.">
<title>SRCT Weather - 76&#176; F</title>
<title>SRCT Weather &bull; 76&#176; F</title>
<link rel="stylesheet" href="weather.css">
<link rel="icon" type="image/x-icon" href="lib/favicon.ico" />
</head>
// client entry point, imports all client code
import { Template } from 'meteor/templating';
import '../imports/ui/body.js';
import './main.html';
// Static dict of GMU Campus locations
LOCATIONS = {
FAIRFAX: {name: 'Fairfax', lat: '38.830295', long: '-77.307717'},
ARLINGTON: {name: 'Arlington', lat: '38.885025', long: '-77.101114'},
SCITECH: {name: 'SciTech', lat: '38.756211', long: '-77.521461'},
KOREA: {name: 'Mason Korea', lat: '37.367863', long: '126.630984'}//,
//RAK: {name: 'Mason Ras-Al-Khaimah', lat: '0', long: '0'} NEED LAT AND LONG
};
"use strict";
import { Mongo } from 'meteor/mongo';
export const WeatherData = new Mongo.Collection('weather-data');
Meteor.methods({
'weatherDataForLoc': function (lat, long) {
// API_KEY is an environmental veriable, you can set it with a JS file in
// server/lib or in your server control panel.
var API_KEY = process.env.API_KEY;
var apiURL = 'https://api.forecast.io/forecast/' + API_KEY + '/' + lat + ',' + long;
var response = HTTP.get(apiURL).data;
return response;
}
});
export function refreshData() {
for(var key in LOCATIONS) {
const current = LOCATIONS[key];
......
import './body.html';
for(var key in LOCATIONS) {
var current = LOCATIONS[key];
console.log(current.name);
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
console.log(res);
//Sends the result of the API call to the browser console, will change
});
}
import { Template } from 'meteor/templating';
import { WeatherData } from '../api/data.js';
import '../../client/weather.html';
Template.body.helpers({
current() {
return WeatherData.find({});
},
});
import { WeatherData } from '../imports/api/data.js';
// server entry point, imports all server code
import { Meteor } from 'meteor/meteor';
import { WeatherData } from '../imports/api/weather-data.js';
Meteor.startup(() => {
// code to run on server at startup
});
//import 'imports/ui/dataview.js'; //seems to be the problem?
if (Meteor.isClient) {
for(var key in LOCATIONS) {
var current = LOCATIONS[key];
console.log(current.name);
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
console.log(res);
//Sends the result of the API call to the browser console, will change
});
}
Template.weather.helpers({
updateData: function() {
}
});
Template.weather.events({
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
Meteor.methods({
'weatherDataForLoc': function (lat, long) {
//API_KEY is an environmental veriable, you can set it with a JS file in
// server/lib or in your server control panel.
var API_KEY = process.env.API_KEY;
var apiURL = 'https://api.forecast.io/forecast/' + API_KEY + '/' + lat + ',' + long;
var response = HTTP.get(apiURL).data;
return response;
}
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment