diff options
| author | Jan Tuomi <jan.tuomi@eficode.com> | 2018-07-13 12:25:26 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan.tuomi@eficode.com> | 2018-07-13 12:25:26 +0300 |
| commit | a69b3b644a9275e43a3832ed9cf3ccfbda336189 (patch) | |
| tree | 3675207b5e0f31c6dadc8fd01f0e7195ac7fc349 /index.js | |
| parent | bd993ccdf8aa2cadc3722d2d169386a7b24661c7 (diff) | |
Add a list of endpoints to the landing page
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -10,12 +10,19 @@ const db = require('monk')(process.env.MONGO_URL); const express = require('express'); const app = express(); +app.set('view engine', 'ejs'); +app.set('views', path.join(__dirname, 'views')); + const requireFromString = require('require-from-string'); const models = require('./models')(db); const {installPackagesFromDatabase} = require('./npm')(models); -app.get('/', (req, res) => { - res.sendFile(path.join(__dirname, '/frontpage.html')); +app.get('/', async (req, res) => { + const endpointObjects = await models.endpoints.find({}); + const endpoints = endpointObjects.map(e => e.name); + res.render('frontpage', { + endpoints + }); }); app.all('/:path*', async (req, res) => { |
