From e28975b889a66f8c146bafcc5b4683435d0c477a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Tue, 8 Oct 2013 22:13:20 +0200 Subject: [PATCH] bla --- node/.gitignore | 3 +++ node/bla.js | 25 ------------------------- node/package.json | 11 ++++++----- node/public/style.css | 6 ++++++ node/statusbot.js | 13 ++++++++++++- node/views/index.jade | 24 ++++++++++++++++++++++++ node/views/layout.jade | 16 ++++++++++++++++ 7 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 node/.gitignore delete mode 100644 node/bla.js create mode 100644 node/public/style.css create mode 100644 node/views/index.jade create mode 100644 node/views/layout.jade diff --git a/node/.gitignore b/node/.gitignore new file mode 100644 index 0000000..7de75b3 --- /dev/null +++ b/node/.gitignore @@ -0,0 +1,3 @@ +.idea/ +*.iml +atlassian-ide-plugin.xml \ No newline at end of file diff --git a/node/bla.js b/node/bla.js deleted file mode 100644 index 6d1a3f7..0000000 --- a/node/bla.js +++ /dev/null @@ -1,25 +0,0 @@ - - - - - -client.on("error", function (err) { - console.log("Redis Error " + err); -}); - -client.on("connect", function () { - client.set("24:77:03:a9:f3:f4","lucas"); - client.set("3c:97:0e:22:b7:68","lucas"); - client.set("a0:0b:ba:c7:98:e5","lucas"); - client.set("b8:27:eb:7d:6f:d2","rpi2"); - client.set("b8:27:eb:7b:9b:9a","rpi3"); - client.set("a8:88:08:10:a0:c5","pascal"); - client.set("c8:97:9f:72:8f:67","fisch"); - - -}); - - - - - diff --git a/node/package.json b/node/package.json index afea5d5..276bc39 100644 --- a/node/package.json +++ b/node/package.json @@ -4,10 +4,11 @@ "version": "0.0.1", "private": true, "dependencies": { - "express": "3.x", - "net-snmp": "x", - "redis": "x", - "underscore": "x" + "express": "3.*", + "net-snmp": "*", + "redis": "*", + "underscore": "*", + "jade": "*" }, - "main": "statusbot" + "main": "index" } diff --git a/node/public/style.css b/node/public/style.css new file mode 100644 index 0000000..d6d84b0 --- /dev/null +++ b/node/public/style.css @@ -0,0 +1,6 @@ +body { + + background: #ececec; + color: #343434; + +} \ No newline at end of file diff --git a/node/statusbot.js b/node/statusbot.js index d612694..c4d0e5a 100644 --- a/node/statusbot.js +++ b/node/statusbot.js @@ -72,7 +72,18 @@ function start() { app.get('/api/simple/v2', function(req, res) { res.send(simpleanswer); }); - + app.set('views', __dirname + '/views'); + app.set('view engine', 'jade'); + app.use(express.static(__dirname + '/public')) + + app.get('/', function (req, res) { + res.render('index', + { title : 'Home' } + ) + }); + + + app.disable('x-powered-by'); app.listen(3000); snmpMac.poll(); diff --git a/node/views/index.jade b/node/views/index.jade new file mode 100644 index 0000000..7ca29e6 --- /dev/null +++ b/node/views/index.jade @@ -0,0 +1,24 @@ +extend layout + +block content + p + | Vivamus hendrerit arcu sed erat molestie + | vehicula. Sed auctor neque eu tellus + | rhoncus ut eleifend nibh porttitor. Ut in. + p + | Donec congue lacinia dui, a porttitor + | lectus condimentum laoreet. Nunc eu + | ullamcorper orci. Quisque eget odio ac + | lectus vestibulum faucibus eget in metus. + | In pellentesque faucibus vestibulum. Nulla + | at nulla justo, eget luctus tortor. + +block sidebar + .widget + h1 Widget + p + | Sed auctor neque eu tellus rhoncus ut + | eleifend nibh porttitor. Ut in nulla enim. + p + | Vivamus hendrerit arcu sed erat molestie + | vehicula. \ No newline at end of file diff --git a/node/views/layout.jade b/node/views/layout.jade new file mode 100644 index 0000000..4bf8a56 --- /dev/null +++ b/node/views/layout.jade @@ -0,0 +1,16 @@ +!!!5 +html + head + title #{title} - My Site + link(rel='stylesheet', href='/style.css') + body + header + h1 My Site + .container + .main-content + block content + .sidebar + block sidebar + footer + hr + p Running on node with Express and Jade \ No newline at end of file