-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Data for countries and cities * Implemented API call to fetch 7-day weather data for the selected city * Fetch weather data for those countries which have no cities * Proper error handling * Made website mobile responsive * Added a properly documented README file
- Loading branch information
0 parents
commit 273e1b2
Showing
887 changed files
with
3,368,291 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PORT = 8000 | ||
FORECA_TOKEN = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9wZmEuZm9yZWNhLmNvbVwvYXV0aG9yaXplXC90b2tlbiIsImlhdCI6MTY3MDg2NDkxMiwiZXhwIjo5OTk5OTk5OTk5LCJuYmYiOjE2NzA4NjQ5MTIsImp0aSI6IjNiZTZmYzJkODY5NjUxMzYiLCJzdWIiOiJ5YXNpci1xYWRlZXIiLCJmbXQiOiJYRGNPaGpDNDArQUxqbFlUdGpiT2lBPT0ifQ.JmoFmksJb6hfWzO1_ddEOKLwSbGFQFAiRHXT_VMx87M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PORT = 8000 | ||
FORECA_TOKEN = SomETokEnVaLuE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# ForeCast | ||
|
||
Weekly Forecast that allows users to view the 7-day forecast for any user-specified | ||
location in the world. | ||
|
||
# Getting Started | ||
## Pre-requisites | ||
Please meet the following requirements: | ||
|
||
- node version 14.21.1 installed | ||
- Foreca API key (This web app Uses third part api from foreca (https://developer.foreca.com/) to fetch weather records. The user can select country form the list and then is able to select city from respective country) | ||
## How to install | ||
- Do `npm install` in terminal opened in current folder | ||
- Add your `FORECA_TOKEN` in .env | ||
- For running in dev env, do `npm run dev` else do `npm start` | ||
|
||
## How to Run Web Server | ||
- For running in dev env, do `npm run dev` else do `npm start` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const express = require('express') | ||
const dotenv = require('dotenv') | ||
const path = require('path') | ||
const MainRoutes = require('./src/routes') | ||
const viewPath = require('./src/middleware/viewPath') | ||
|
||
// Using env variables | ||
dotenv.config() | ||
|
||
const PORT = process.env.PORT || 8080 | ||
|
||
// Start Express App in node server | ||
const app = express() | ||
app.use(express.json()) | ||
|
||
// Static folder | ||
app.use('/static', express.static(path.join(__dirname, '/src/public'))) | ||
|
||
// Setting view templating engine | ||
app.set('view engine', 'ejs') | ||
|
||
// Setting default view folder | ||
app.set('views', path.join(__dirname, '/src/views')) | ||
|
||
// Using MainRouter | ||
app.use('/', viewPath, MainRoutes) | ||
|
||
app.listen(PORT, () => { | ||
console.log(PORT) | ||
console.log(`started listening to port ${PORT}`) | ||
}) | ||
|
||
// Error function handler | ||
app.use((err, req, res, next) => { | ||
res.locals.message = err.message | ||
const status = err.statusCode || err.status || 500 | ||
res.locals.status = status | ||
res.locals.error = req.app.get('env') === 'development' ? err : {} | ||
res.status(status).json({ | ||
error: { | ||
statusCode: status, | ||
messages: err.message, | ||
}, | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.