From 156616ebcf57e84369abf739c398cf1b665dae6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Sun, 6 Jul 2014 01:42:11 +0200 Subject: [PATCH] try to add a image api --- node/statusbot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node/statusbot.js b/node/statusbot.js index e12f160..9e72970 100644 --- a/node/statusbot.js +++ b/node/statusbot.js @@ -7,6 +7,7 @@ var moment = require('moment'); var SnmpMac = require("./snmp-mac"); var IpPoll = require("./ip-poll"); var routes = require("./routes"); +var path = require('path'); var spaceanswer = { api: "0.13", @@ -116,11 +117,11 @@ app.get('/api/usercount', function (req, res) { }); app.get('/api/simple/image', function (req, res) { if(spaceanswer.state.open == true) { - res.sendfile('img/green.png'); + res.sendfile(path.resolve(__dirname, 'public/img/green.png')); } else if(spaceanswer.state.open == false) { - res.sendfile('img/red.png'); + res.sendfile(path.resolve(__dirname, 'public/img/red.png')); } else { - res.sendfile('img/yellow.png'); + res.sendfile(path.resolve(__dirname, 'public/img/yellow.png')); } });