Skip to content

Commit

Permalink
removed unwanted comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rsriniva authored Sep 11, 2019
1 parent 6e34dbf commit 8613e00
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions weather/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const express = require('express');
const router = express.Router();
//const request = require('request');
const fetch = require("node-fetch");
require('dotenv').config();
const OWM_API_KEY = process.env.OWM_API_KEY || 'invalid_key';
Expand Down Expand Up @@ -33,25 +32,6 @@ router.post('/get_weather', async function (req,res) {
res.render('index', {weather: null, error: 'Error: Unable to invoke OpenWeatherMap API'});
}

/* request(url, function (err, response, body) {
if (err) {
res.render('index', {weather: null, error: 'Error: Unable to invoke OpenWeatherMap API'});
}
else {
let weather = JSON.parse(body);
console.log('response from OpenWeatherMap API: ' + body);
if(weather.cod == '404' && weather.main == undefined) {
res.render('index', {weather: null, error: 'Error: Unknown city'});
}
else if (weather.cod == '401' && weather.main == undefined) {
res.render('index', {weather: null, error: 'Error: Invalid API Key. Please see http://openweathermap.org/faq#error401 for more info.'});
}
else {
res.render('index', {weather: weather, error: null});
}
}
}); */

});

module.exports = router;

0 comments on commit 8613e00

Please sign in to comment.