Skip to content

adding files #1

Open
Noormasarwa wants to merge 4 commits intoreviewfrom
master
Open

adding files #1
Noormasarwa wants to merge 4 commits intoreviewfrom
master

Conversation

@Noormasarwa
Copy link
Owner

No description provided.

Copy link

@ameliawalcek ameliawalcek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice job, left you some comments

const cityName = $('#textLine').val()
if(!cityName)
return
model.getCityData(cityName).then(val => view.renderer(val))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use async await if you are using it in the rest of the code


}

async getDataFromDB(){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this instead getCities that describes better when the method does.


async saveCity(cityObj){
return $.post('/city',cityObj,function(response){
console.log(response)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use async await here. Keep things consistent


router.get(`/city/:cityName`,async function(req,res){
const cityName = req.params.cityName
axios.get(`http://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=561ae52a3ff46bd22a23af0e1667cbf1`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make a .env file to save your keys. Keep your keys safe.

const cityName = req.params.cityName
axios.get(`http://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=561ae52a3ff46bd22a23af0e1667cbf1`)
.then(function (response) {
// handle success

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete comments when you are finished with your code

if(err)
res.send(err)
else
res.send("ok")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look into HTTP status codes. Try to use those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments