Browse Source

Setup view model hierarchy

pm2
Luke Childs 8 years ago
parent
commit
e2f881affe
  1. 5
      index.js
  2. 3
      viewModels/index.js
  3. 3
      viewModels/listing.js
  4. 0
      views/listing.html

5
index.js

@ -1,12 +1,11 @@
const nunjucks = require('nunjucks');
const express = require('express');
const viewModel = require('./viewModels');
const app = express();
const port = process.env.port || 3000;
nunjucks.configure('views', { express: app });
app.get('/', (req, res) => {
res.render('index.html');
});
app.get('/', viewModel.listing);
app.listen(port, () => console.log(`Tor Explorer listening on port ${port}`));

3
viewModels/index.js

@ -0,0 +1,3 @@
module.exports = {
listing: require('./listing')
};

3
viewModels/listing.js

@ -0,0 +1,3 @@
module.exports = (req, res) => {
res.render('listing.html');
}

0
views/index.html → views/listing.html

Loading…
Cancel
Save