Skip to content

Commit bec8833

Browse files
committed
Add view engine, and basic views
1 parent e71651d commit bec8833

File tree

7 files changed

+316
-244
lines changed

7 files changed

+316
-244
lines changed

config.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ module.exports = require('rc')('filedrop', {
44
multerLimits: {
55
fileSize: 10 * 1024 * 1024,
66
},
7+
dev: false,
78
});

index.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
#!/usr/bin/env node
22
const express = require('express');
33
const morgan = require('morgan');
4+
const nunjucks = require('nunjucks')
45
const config = require('./config');
56
const log = require('./log');
67

8+
if (config.dev) {
9+
log.warn('Running in dev mode');
10+
}
11+
712
const app = express();
813

14+
nunjucks.configure('views', {
15+
autoescape: true,
16+
express: app,
17+
watch: config.dev,
18+
});
19+
920
app.use(morgan('combined', { stream: log.stream }));
1021

1122
app.use(express.static('public'));
1223

1324
app.get('/', (req, res) => {
14-
res.send('hello');
25+
res.render('index.html');
1526
});
1627

1728
app.listen(config.port, () => {

0 commit comments

Comments
 (0)