1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

Attempting to make it easier to work with a single device. Still not bound to the new controlService.

This commit is contained in:
Simo Kinnunen 2014-02-05 11:08:37 +09:00
parent 37303c5d92
commit 36d0af71b5
11 changed files with 141 additions and 75 deletions

View file

@ -1,6 +1,7 @@
var url = require('url')
var http = require('http')
var events = require('events')
var path = require('path')
var express = require('express')
var validator = require('express-validator')
@ -73,13 +74,14 @@ module.exports = function(options) {
groupRouter.emit(channel.toString(), channel, data)
})
app.get('/partials/:name', function(req, res) {
app.get('/partials/*', function(req, res) {
var whitelist = {
'deviceList': true
'devices/index': true
, 'devices/control': true
}
if (whitelist[req.params.name]) {
res.render('partials/' + req.params.name)
if (whitelist.hasOwnProperty(req.params[0])) {
res.render(path.join('partials', req.params[0]))
}
else {
res.send(404)