Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const axios = require("axios");
|
||||
|
||||
/**
|
||||
* Gets coordinates from an external API
|
||||
*
|
||||
*/
|
||||
function getCoords(req, res) {
|
||||
axios
|
||||
.get("https://freegeoip.app/json/")
|
||||
.then((result) => {
|
||||
return res.status(result.status).json(result.data).end();
|
||||
})
|
||||
.catch((err) => {
|
||||
return res.status(500).json(err).end();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCoords,
|
||||
};
|
||||
Reference in New Issue
Block a user