@evan17gr try this one:
//variables
var getLongtitude;
var getLatitude;
var api;
var url = "https://fcc-weather-api.glitch.me/api/current?";
//ask for users permission
window.onload = function getUsersPosition(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(getLatitudeAndLongtitude);
}
else{
alert("Your browser doesn't support geolocation");
}
}
//get the user's longtitude and latitude
function getLatitudeAndLongtitude(position){
getLatitude = position.coords.latitude;
getLongtitude = position.coords.longitude;
api = url + "lat=" +getLatitude + "&" + "lon=" + getLongtitude;
getObjs();
}
//new xmlhttprequest
function getObjs(){
var req = new XMLHttpRequest();
req.open("GET", api,true);
req.onload = function(){
const getText = JSON.parse(req.responseText);
console.log(getText);
}
req.send();
}
--save
flag
npm update
sudo npm install -g --force nodemon
npm run dev
?
nodemon myServer.js
?
--save-dev
try using --only=dev
--dev
and --save
dev were being deprecated -- that might be the issue
npm run dev
it threw an error
$ npm run dev
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\krisb\Desktop\Projects\MyMongoProject\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\krisb\Desktop\Projects\MyMongoProject\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\krisb\AppData\Roaming\npm-cache\_logs\2020-05-12T17_51_08_693Z-debug.log
nodemon [server file].js
command?