This file contains hidden or 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
const jwt = require('jsonwebtoken'); | |
const user = require('../../models/dummyUser'); | |
module.exports = (app) => { | |
app.post('/user/login', (req, res, next) => { | |
const { body } = req; | |
const { username } = body; | |
const { password } = body; |
This file contains hidden or 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
module.exports = { | |
username: 'user123', | |
password: '1234', | |
firstName: 'Jon', | |
lastName: 'Doe', | |
dob: '12/11/1991', | |
email: '[email protected]', | |
address: { | |
street: '555 Bayshore Blvd', | |
city: 'Tampa', |
This file contains hidden or 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
app.get('/search-location-weather', (req, res) => { | |
//build api URL with user zip | |
const baseUrl = 'http://api.openweathermap.org/data/2.5/weather?zip='; | |
//ENTER YOUR API KEY HERE (make sure to no include < >) | |
const apiId = '&appid=<YOUR API KEY GOES HERE>&units=imperial'; | |
const userLocation = (url1, url2, zipcode) => { | |
let newUrl = url1 + zipcode + url2; | |
return newUrl; | |
}; |
This file contains hidden or 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
const WeatherCardError = ( | |
<div className='weatherCardContainer'> | |
<div className='weatherCardError'> | |
<img src={NoLocationFound} alt='no location found'/> | |
<p> Whoa! Looks like there was an error with your zipcode.</p> | |
<Link to='/'><button>Try Again</button></Link> | |
</div> | |
</div> | |
) |
This file contains hidden or 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
{ | |
"data": { | |
"cod": "404", | |
"message": "city not found" | |
} | |
} |
This file contains hidden or 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
{ | |
"data": { | |
"coord": { | |
"lon": -75.02, | |
"lat": 18.17 | |
}, | |
"weather": [ | |
{ | |
"id": 803, | |
"main": "Clouds", |
This file contains hidden or 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
import React, { Component } from 'react'; | |
import { Link } from 'react-router-dom'; | |
//Assets | |
import ThunderStormIcon from './assets/weather_icons/01W.svg'; | |
import RainIcon from './assets/weather_icons/02W.svg'; | |
import SnowIcon from './assets/weather_icons/03W.svg'; | |
import ClearIcon from './assets/weather_icons/04W-DAY.svg'; | |
import CloudsIcon from './assets/weather_icons/05W.svg'; | |
import NoLocationFound from './assets/no-location.svg'; |
This file contains hidden or 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
import React, { Component } from 'react'; | |
import LightningBolt from './assets/lightning.svg'; | |
const Home = () => { | |
return ( | |
<div> | |
<div className='header'> | |
<h2>Weather Forcast</h2> | |
<img src={LightningBolt}/> |
This file contains hidden or 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './views/css/styles.css'; | |
import {BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | |
import registerServiceWorker from './registerServiceWorker'; | |
//Views | |
import App from './views/App'; | |
import Home from './views/Home'; | |
import CurrentWeather from './views/CurrentWeather'; |
This file contains hidden or 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
const express = require('express'); | |
const app = express(); | |
const port = 5000; | |
app.use(express.urlencoded({ extended: true })); | |
app.use(express.json()); | |
require('./routes')(app); | |
app.get('/', (req, res) => { |