Gather weatherdata from Yr.no with built using Deno with TS.
- TypeScript 100%
|
|
||
|---|---|---|
| src | ||
| .build.yml | ||
| .gitignore | ||
| deno.json | ||
| deno.lock | ||
| deps.ts | ||
| LICENSE | ||
| mod.d.ts | ||
| mod.ts | ||
| README.md | ||
d-yr
Access Yr's weather API and Nominatim's names API for getting weather details about a specific location.
You can read more about the API's on met.yr.no and Nominatim.
This project has both a CLI and functions to access Yr.no's API.
Usage
Example for current weather
import { getCurrentWeather } from "https://deno.land/x/dyr/mod.ts";
const currentWeather = getCurrentWeather("Bergen");
// do what you need to do with the weather data.
Example for forecasted weather
import { getForecastedWeather } from "https://deno.land/x/dyr/mod.ts";
const location = "Bergen";
const hoursAhead = 5;
const jsonOutput = true; // The returned response as JSON
const currentWeather = getForecastedWeather(location, hoursAhead, jsonOutput);
// do what you need to do with the weather data.
CLI
Installation
deno install --allow-net=api.met.no,nominatim.openstreetmap.org \
-n yr https://deno.land/x/dyr/src/cli.ts
You have now installed d-yr as yr.
Usage
Run the CLI with:
# Current weather forecast for location
yr current Bergen
# OR forecast for location
yr forecast Bangkok 5