diff --git a/app.js b/app.js index 8be120b..b86c6c2 100755 --- a/app.js +++ b/app.js @@ -1,4 +1,5 @@ var fs = require('fs') +var path = require('path') var util = require('util') var express = require('express') var morgan = require('morgan') @@ -14,6 +15,7 @@ var harmonyActivityUpdateTimer var app = express() app.use(bodyParser.urlencoded({ extended: false })) +app.use(express.static(path.join(__dirname, 'public'))); var logFormat = "'[:date[iso]] - :remote-addr - :method :url :status :response-time ms - :res[content-length]b'" app.use(morgan(logFormat)) @@ -92,6 +94,14 @@ function activityByName(activityName){ return activity } +app.get('/_ping', function(req, res){ + res.send('OK'); +}) + +app.get('/', function(req, res){ + res.sendfile('index.html'); +}) + app.get('/activities', function(req, res){ res.json({activities: cachedHarmonyActivities()}) }) diff --git a/public/harmony-icon.png b/public/harmony-icon.png new file mode 100644 index 0000000..5e7e960 Binary files /dev/null and b/public/harmony-icon.png differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..820e724 --- /dev/null +++ b/public/index.html @@ -0,0 +1,42 @@ + + + + + Harmony API + + + + +
+

Harmony API

+ +
+

Info

+

GET /status

+

GET /activities

+ +

Control

+

PUT /off

+

POST /start_activity?activity_name=Watch%20TV

+
+ + +
+ + +