Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harrydehix/dwd-warn
Unofficial api for official DWD warnings
https://github.com/harrydehix/dwd-warn
Last synced: 23 days ago
JSON representation
Unofficial api for official DWD warnings
- Host: GitHub
- URL: https://github.com/harrydehix/dwd-warn
- Owner: harrydehix
- Created: 2023-11-05T07:01:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-05T07:03:48.000Z (about 1 year ago)
- Last Synced: 2023-11-05T08:19:14.230Z (about 1 year ago)
- Language: TypeScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dwd-warn
Unofficial api for official DWD warnings. Uses the official _JSONP_ warn file which is located [here](https://www.dwd.de/DWD/warnungen/warnapp/json/warnings.json). Warnings are always up to date with a maximum delay of 10 minutes. Learn more [here](https://www.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/objekteinbindung.html).
# Starter guide
### 1. Install the package
Install this package with npm:
```batch
npm install dwd-warn
```### 2. Import the package
Inside your nodejs script import the package:
```ts
const dwd = require("dwd-warn").default;
// or
import dwd from "dwd-warn";
```### 3. Fetch the warnings!
Fetch the current warnings. This code is asynchronous, it uses _Promises_, an asynchronous wrapper function is recommended.
```ts
async main(){
const warnings = await dwd.fetchWarnings();
const ahrweiler_warnings = warnings.filterByRegionName("Kreis Ahrweiler");if(ahrweiler_warnings){
console.log(ahrweiler_warnings);
}else{
console.log("No warnings available!");
}
}main();
```# Community
This project is updated on demand. If you have a question, found a bug or similar feel free to ask [here](https://github.com/harrydehix/dwd-warn/issues/new).