npm install
get a free weather underground api key, set up a todo server and set up config.json
:
{
"ALERT_SERVER_HOST" : "1.2.3.4",
"ALERT_SERVER_PORT" : 3000,
"WUNDERGROUND_API_KEY" : "<your api key here>",
"TODO_SERVER_URL" : "https://path/to/your-todo-server"
}
then
npm start
nw-dashboard has a built-in server for receiving, retrieving and deleting (very rudimentary) alert messages. server starts up automatically at http://<host>:<port>
, where port
is the value specified in config.json
as "ALERT_SERVER_PORT"
(defaults to 8080
) and host
is "ALERT_SERVER_HOST"
(default is localhost
, but I've had problems seeing this elsewhere on a network and ended up specifying a network IP here to make it visible). note that for now there is no persistence for alerts--they're just stored in-memory as an array
routes:
body must contain the following two fields:
{
"title" : "alert title",
"description" : "this is a longer description of the alert"
}
otherwise the server will reject them with a 400 Bad Request
. if accepted, server will send 201 Created
with the url of the resource (/alerts/<id>
)
deletes the alert with the specified id and return 204 No Content
if there is an alert with that id; 404 Not Found
otherwise
returns the alert with the specified id (200 OK
) if there is an alert with that id; 404 Not Found
otherwise
updates fields of the alert with the specified id with values in the body of the request (204 No Content
); fields that are not "title"
and "description"
are ignored. if alert with specified id isn't found, 404
returns all alerts (200 OK
)