Browse Source

Add node template

pm2
Luke Childs 8 years ago
parent
commit
43eeb9fe45
  1. 8
      controllers/node.js
  2. 11
      views/node.html

8
controllers/node.js

@ -1,5 +1,11 @@
const tor = require('../lib/tor'); const tor = require('../lib/tor');
module.exports = (req, res, next) => { module.exports = (req, res, next) => {
tor.node(req.params.id).then(node => res.json(node)) tor.node(req.params.id)
.then(node => res.render('node.html', {
node: node,
}))
.catch(error => res.render('node.html', {
error: error
}));
} }

11
views/node.html

@ -0,0 +1,11 @@
{% extends 'index.html' %}
{% block main %}
{% if error %}
<h2>{{ 'Invalid node' if error.statusCode == 400 else error.statusMessage }}</h2>
{% else %}
<pre>{{ node | dump }}</pre>
{% endif %}
{% endblock %}
Loading…
Cancel
Save