Add normal routes

This commit is contained in:
Elliot DeNolf
2018-04-13 21:56:06 -06:00
parent 7082cb7e42
commit 33bf4aeff6
5 changed files with 13 additions and 5 deletions

View File

@@ -6,7 +6,10 @@ const app = express();
app.set('view engine', 'pug'); app.set('view engine', 'pug');
var payloadBootstrap = payload(app); var payloadBootstrap = payload(app);
app.set('views', payloadBootstrap.views); app.set('views', [__dirname + '/views', payloadBootstrap.views]);
app.get('/', (req, res) => res.send('Hello World!')) app.get('/', (req, res) => res.render('index',
{
title: 'Index'
}));
app.listen(3000, () => console.log('Example app listening on port 3000!')) app.listen(3000, () => console.log('Example app listening on port 3000!'))

View File

@@ -5,12 +5,15 @@ module.exports = function (app) {
app.get('/login', function (req, res) { app.get('/login', function (req, res) {
res.render('login', res.render('login',
{ {
title: 'Payload login' title: 'Payload Login'
}) })
}); });
app.get('/admin', function (req, res) { app.get('/admin', function (req, res) {
res.send('GET page for Admin interface') res.render('admin',
{
title: 'Payload Admin'
})
}); });
// /payload/<model-name>/?arg1=blah&arg2=blah // /payload/<model-name>/?arg1=blah&arg2=blah

1
payload/views/admin.pug Normal file
View File

@@ -0,0 +1 @@
p Admin Page

View File

@@ -1 +1 @@
p Basic Pug page! p Login Page

1
views/index.pug Normal file
View File

@@ -0,0 +1 @@
p Index Page