Nodemill Addins


Install Fields, APIs and pages (coming soon) using the public repository.

Search:
Within:

Nodemill API: weather

Nodemill Version Nodemill Downloads

Install

nodemill install api weather

Details

  • Author: Dogfish Mobile
  • Short desc: Get current and 7 day forecast
  • Keywords: weather, forecast

Node dependencies

  • moment

Full Description

Get weather for any location:

  • uses https://darksky.net/dev (formally weather.io)
  • first 1000 requests per day are free
  • has a two hour cache by default to save on API requests

Instructions:

  1. Sign up at https://darksky.net/dev/register and get an API key
  2. Put that key into ./config/keys.json (under weather.key)
  3. Use the API - see example below

Weather font:

In your app, if you want to use a weather font you can do. Part of the returned data is a font icon code (eg F031) - this is the char code for the font at https://github.com/erikflowers/weather-icons - then you can scale and color the icons much easier then using pngs etc.

Version history

  • 1.0.0 Created

Examples

/api/weather/56.2298,-3.8344

Response:

{
    "headers": {
        "code": 200
    },
    "data": {
        "location": "56.2298,-3.8344",
        "temp": 11,
        "icon": "clear-day",
        "fonticon": "F00D",
        "summary": "Drizzle on Tuesday, with temperatures peaking at 16°C on Monday.",
        "forecast": [
            {
                "date": "2016-10-01",
                "day": "Saturday",
                "max": 14,
                "min": 6,
                "icon": "partly-cloudy-night",
                "fonticon": "F031",
                "summary": "Partly cloudy starting in the afternoon."
            },
            {
                "date": "2016-10-02",
                "day": "Sunday",
                "max": 14,
                "min": 7,
                "icon": "partly-cloudy-night",
                "fonticon": "F031",
                "summary": "Partly cloudy overnight."
            },
            {
                "date": "2016-10-03",
                "day": "Monday",
                "max": 16,
                "min": 6,
                "icon": "partly-cloudy-day",
                "fonticon": "F002",
                "summary": "Mostly cloudy throughout the day."
            },
            {
                "date": "2016-10-04",
                "day": "Tuesday",
                "max": 15,
                "min": 9,
                "icon": "rain",
                "fonticon": "F019",
                "summary": "Drizzle in the morning."
            },
            {
                "date": "2016-10-05",
                "day": "Wednesday",
                "max": 16,
                "min": 8,
                "icon": "partly-cloudy-day",
                "fonticon": "F002",
                "summary": "Mostly cloudy throughout the day."
            },
            {
                "date": "2016-10-06",
                "day": "Thursday",
                "max": 15,
                "min": 5,
                "icon": "partly-cloudy-day",
                "fonticon": "F002",
                "summary": "Mostly cloudy throughout the day."
            },
            {
                "date": "2016-10-07",
                "day": "Friday",
                "max": 13,
                "min": 4,
                "icon": "partly-cloudy-day",
                "fonticon": "F002",
                "summary": "Mostly cloudy throughout the day."
            },
            {
                "date": "2016-10-08",
                "day": "Saturday",
                "max": 13,
                "min": 4,
                "icon": "partly-cloudy-day",
                "fonticon": "F002",
                "summary": "Mostly cloudy throughout the day."
            }
        ]
    },
    "md5": "1153be"
}