-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 1.04 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const config = require('./modules/config/config')
const express = require('express')
const app = express()
const server = require('http').Server(app)
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
const adapter = new FileSync('sermons.json')
const db = low(adapter)
const adapterArchive = new FileSync('sermonsArchive.json')
const dbArchive = low(adapterArchive)
if (app.get('env') === 'development') {
app.locals.pretty = true
}
const sermonsDb = db.get('audio').sortBy('date').reverse().value()
const sermonsArchiveDb = dbArchive.get('audio').sortBy('date').reverse().value()
server.listen(config.node().port, () => console.log('ECHO Podcast listening on: http://' + config.node().ip + ":" + config.node().port))
app.set('view engine', 'pug')
app.use('/static', express.static('public'))
app.get('/', function (req, res) {
res.render('index', {
title: 'ECHO PODCASTS',
S3: config.storage().S3,
sermonsDb: sermonsDb,
sermonsArchiveDb: sermonsArchiveDb,
config: config
})
})