Skip to content

Instantly share code, notes, and snippets.

@caalle
Last active March 15, 2020 19:52
Show Gist options
  • Select an option

  • Save caalle/08594c77ada8a2a40651438e794aa4fc to your computer and use it in GitHub Desktop.

Select an option

Save caalle/08594c77ada8a2a40651438e794aa4fc to your computer and use it in GitHub Desktop.
const lat = 45.7;
const lng = -6.0;
const params = [
'secondarySwellDirection', 'secondarySwellHeight', 'secondarySwellPeriod',
'windWaveDirection', 'windWaveHeight', 'windWavePeriod',
'swellDirection', 'swellHeight', 'swellPeriod',
'waveDirection', 'waveHeight', 'wavePeriod',
'windDirection', 'windSpeed', 'gust',
'waterTemperature',
].join(',');
fetch(`https://api.stormglass.io/v2/weather/point?lat=${lat}&lng=${lng}&params=${params}`, {
headers: {
// Get your key by signing up.
'Authorization': '2c16411d-8f11-4565-98a8-321c4e3eef9c'
}
}).then((response) => response.json()).then((jsonData) => {
// Do something with response data.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment