Skip to content

Commit

Permalink
Update server.js
Browse files Browse the repository at this point in the history
Comment out the NewsAPI and Weather API calls
  • Loading branch information
JancoEngelbrecht authored Sep 8, 2024
1 parent ae66e84 commit 2f95f85
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ app.get('/', (req, res) => {
res.json("janco");
});

//Get news from NewsAPI
app.get('/news', async (req, res) => {
try {
const response = await axios.get('https://newsapi.org/v2/top-headlines', {
params: {
country: 'us',
apiKey: 'a5c9c48cee5b4d81b4492fa66bf61661'
}
});
res.json(response.data);
} catch (error) {
res.status(500).json({ error: 'Error fetching news data' });
}
});
// //Get news from NewsAPI
// app.get('/news', async (req, res) => {
// try {
// const response = await axios.get('https://newsapi.org/v2/top-headlines', {
// params: {
// country: 'us',
// apiKey: 'a5c9c48cee5b4d81b4492fa66bf61661'
// }
// });
// res.json(response.data);
// } catch (error) {
// res.status(500).json({ error: 'Error fetching news data' });
// }
// });

// Route to get weather data
app.get('/weather', (req, res) => {
const data = {
temperature: 25,
condition: 'Cloudy'
};
res.json(data);
});
// // Route to get weather data
// app.get('/weather', (req, res) => {
// const data = {
// temperature: 25,
// condition: 'Cloudy'
// };
// res.json(data);
// });

// Start the server
app.listen(port, () => {
Expand Down

0 comments on commit 2f95f85

Please sign in to comment.