Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aershov24/openuv-node
A Node.js client library for OpenUV UV Index API
https://github.com/aershov24/openuv-node
openuv
Last synced: about 2 months ago
JSON representation
A Node.js client library for OpenUV UV Index API
- Host: GitHub
- URL: https://github.com/aershov24/openuv-node
- Owner: aershov24
- Created: 2018-03-12T06:19:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T07:12:40.000Z (almost 7 years ago)
- Last Synced: 2024-10-30T16:44:23.947Z (2 months ago)
- Topics: openuv
- Language: JavaScript
- Homepage: https://www.openuv.io
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
OpenUV - A Node.js client library for [OpenUV UV Index API](https://www.openuv.io)
==========A Node.js client library for [OpenUV UV Index API](https://www.openuv.io).
For API Key, documentation and more detailed info about endpoints and response format see [OpenUV UV Index API Documentation](https://www.openuv.io)
## Installation
```
npm install openuv
```## Basic Usage
To get a real-time UV Index for a particular location you'll need:```javascript
var openuv = require('openuv')('v1','YOUR_API_KEY');openuv.uv({lat: 12.23, lng: 45.32}, (err, data) => {
console.log(JSON.stringify(data, null, 2));
});
```To get a UV Index forecast for a particular location call:
```javascript
var openuv = require('openuv')('v1','YOUR_API_KEY');openuv.forecast({lat: 12.23, lng: 45.32}, (err, data) => {
console.log(JSON.stringify(data, null, 2));
});
```To get protection time for a particular location call:
```javascript
var openuv = require('openuv')('v1','YOUR_API_KEY');openuv.protection({lat: 12.23, lng: 45.32, from: 3.5, to: 3.5}, (err, data) => {
console.log(JSON.stringify(data, null, 2));
});
```### Parameters
The `#uvindex()`,`#forecast()` and `#protection()` methods support passing additional options.
*Below are some examples, for all options consult [OpenUV API documentation](https://www.openuv.io).*Example of requesting UV Index Forecast for a specific altitude for tomorrow:
```javascript
var openuv = require('openuv')('v1','YOUR_API_KEY');var parameters = {
lat: 12.23,
lng: 45.32,
alt: 4523,
dt: moment().add('day',1).toISOString()
}openuv.forecast(parameters, (err, data) => {
console.log(JSON.stringify(data, null, 2));
});
```## Contributing
* Fork the repo & commit changes## Changelog
#### 0.1.1
-Initial release