diff --git a/project/html/helpers/head.ejs b/project/html/helpers/head.ejs index d40b02e2..43baa6a6 100644 --- a/project/html/helpers/head.ejs +++ b/project/html/helpers/head.ejs @@ -23,5 +23,7 @@ + + diff --git a/project/html/helpers/navbar.ejs b/project/html/helpers/navbar.ejs new file mode 100644 index 00000000..ff6ac6f7 --- /dev/null +++ b/project/html/helpers/navbar.ejs @@ -0,0 +1,5 @@ +
\ No newline at end of file diff --git a/project/html/pages/album.ejs b/project/html/pages/album.ejs new file mode 100644 index 00000000..2bcebbe4 --- /dev/null +++ b/project/html/pages/album.ejs @@ -0,0 +1,24 @@ + + + <% include ../helpers/head %> + + + + + +Click on the button for a surprise.
+ + + + + + + + \ No newline at end of file diff --git a/project/html/pages/history.ejs b/project/html/pages/history.ejs new file mode 100644 index 00000000..488b4a06 --- /dev/null +++ b/project/html/pages/history.ejs @@ -0,0 +1,27 @@ + + + <% include ../helpers/head %> + + + + + +Click on the button for a surprise.
diff --git a/project/js/main.js b/project/js/main.js index c045cac2..e227a0c5 100644 --- a/project/js/main.js +++ b/project/js/main.js @@ -1,3 +1,30 @@ +$(document).ready(function(){ + getWeather(); +}) + +function getWeather(searchQuery) { + // var url = "https://api.openweathermap.org/data/2.5/weather?q=Boston&APPID="+apiKey; // Need to figure out how to make sure Heroku is storing my API key + + var url = "https://api.openweathermap.org/data/2.5/weather?q="+searchQuery+"&units=imperial&APPID=de7c147ddb0ac76a8ca839042b94c47a" + + $(".city").text(""); + $(".temp").text(""); + $(".error-message").text(""); + + $.ajax(url,{success: function(data){ + $(".city").text(data.name); + $(".temp").text(data.main.temp); + // console.log(data); // To view in the console log + }, error: function(error){ + $(".error-message").text("An error occurred"); + }}) +} + +function searchWeather() { + var searchQuery = $(".search").val(); + getWeather(searchQuery); +} + function showPicture(){ // use jQuery ($ is shorthand) to find the div on the page and then change the html // 'rounded-circle' is a bootstrap thing! Check out more here: http://getbootstrap.com/css/ diff --git a/project/start.js b/project/start.js index bbe5c402..11ee91b8 100644 --- a/project/start.js +++ b/project/start.js @@ -13,6 +13,15 @@ app.get('/', function(request, response) { response.render('pages/index'); }); +app.get('/album', function(request, response) { + response.render('pages/album'); +}); + +app.get('/history', function(request, response) { + response.render('pages/history'); +}); + + app.listen(app.get('port'), function() { console.log('Node app is running on port', app.get('port')); }); diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..fd7d3e06 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests==2.25.1 \ No newline at end of file