Skip to content

rhappdev/yr.no-interface

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yr.no-interface

Simple request wrapper for the yr.no weather service API.

API

All functions for the API contain the same signature: yrno.func([params,] version [, callback]). params and callback are optional. If no callback is provided a stream is returned so you can use Node's stream awesomeness. params should contain the querystring params as specified at the yr.no docs.

Each request must specify the version as the API requires this.

Examples

Simple Example

var yrno = require('yr.no-interface'),
	dublin = {
		lat: 53.3478,
		lon: 6.2597
	},
	LOC_VER = 1.9;


yrno.locationforecast(dublin, LOC_VER, function (err, xml) {
	if (err) {
		// Something went wrong...
	} else {
		// We got an XML response!
	}
});

Streaming Example

var yrno = require('yr.no-interface'),
	fs = require('fs'),
	dublin = {
		lat: 53.3478,
		lon: 6.2597
	},
	LOC_VER = 1.9;


yrno.locationforecast(dublin, LOC_VER).pipe(fs.createWriteStream('./res.xml'));

About

Wrapper for the yr.no weather service API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%