Skip to content

Commit

Permalink
functions logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yuugou727 committed Jul 5, 2023
1 parent d8741f9 commit 9d3cf17
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 49 deletions.
6 changes: 6 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ exports.weather = functions
return response.json();
})
.then(data => {
functions.logger.debug('[weather] API success');
res.status(200).send(data);
})
.catch(err => {
functions.logger.error('[weather]', err);
res.status(500).send({ message: err.message });
})
} else {
functions.logger.warn('[weather] invalid req:', req);
return res.sendStatus(500);
}
});
Expand All @@ -68,12 +71,15 @@ exports.reverseGeocoding = functions
return response.json();
})
.then(data => {
functions.logger.debug('[reverseGeocoding] API success');
res.status(200).send(data);
})
.catch(err => {
functions.logger.error('[reverseGeocoding]', err);
res.status(500).send({ message: err.message });
})
} else {
functions.logger.warn('[reverseGeocoding] invalid req:', req);
return res.sendStatus(500);
}
});
Expand Down
130 changes: 83 additions & 47 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"dependencies": {
"cors": "^2.8.5",
"firebase-admin": "~11.4.1",
"firebase-functions": "^4.1.1",
"firebase-functions": "^4.4.1",
"node-fetch": "^2.6.1",
"qs": "^6.11.0"
},
"private": true,
"engines": {
"node": "14"
"node": "18"
}
}

0 comments on commit 9d3cf17

Please sign in to comment.