PWA
This commit is contained in:
parent
18401ff0f0
commit
deed72709d
5 changed files with 34 additions and 2 deletions
|
@ -11,6 +11,7 @@ module.exports = {
|
||||||
sessionStore: process.env.SESSION_STORE || './sessions',
|
sessionStore: process.env.SESSION_STORE || './sessions',
|
||||||
sessionMaxAge: Number(process.env.SESSION_MAX_AGE) || 1000 * 60 * 60 * 24 * 7,
|
sessionMaxAge: Number(process.env.SESSION_MAX_AGE) || 1000 * 60 * 60 * 24 * 7,
|
||||||
siteTitle: process.env.SITE_TITLE || 'Christmas Community',
|
siteTitle: process.env.SITE_TITLE || 'Christmas Community',
|
||||||
|
shortTitle: process.env.SHORT_TITLE || 'Christmas',
|
||||||
useCDN: yesNo.parse(process.env.USE_CDN || true),
|
useCDN: yesNo.parse(process.env.USE_CDN || true),
|
||||||
wishlist: require('./wishlist')
|
wishlist: require('./wishlist')
|
||||||
};
|
};
|
||||||
|
|
2
index.js
2
index.js
|
@ -68,6 +68,6 @@ app.use((req, res, next) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.set('view engine', 'pug');
|
app.set('view engine', 'pug');
|
||||||
app.use('/', require('./routes')(db));
|
app.use('/', require('./routes')({ db, config }));
|
||||||
|
|
||||||
app.listen(config.port, () => logger.success('express', `Express server started on port ${config.port}!`))
|
app.listen(config.port, () => logger.success('express', `Express server started on port ${config.port}!`))
|
||||||
|
|
|
@ -2,7 +2,7 @@ const verifyAuth = require('../middlewares/verifyAuth');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = (db) => {
|
module.exports = ({ db, config }) => {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use('/', express.static(path.join(__dirname, '../static')));
|
router.use('/', express.static(path.join(__dirname, '../static')));
|
||||||
|
@ -33,5 +33,7 @@ module.exports = (db) => {
|
||||||
|
|
||||||
router.use('/admin-settings', require('./adminSettings')(db));
|
router.use('/admin-settings', require('./adminSettings')(db));
|
||||||
|
|
||||||
|
router.use('/manifest.json', require('./manifest.json')({ config }))
|
||||||
|
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
25
routes/manifest.json/index.js
Normal file
25
routes/manifest.json/index.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const express = require('express');
|
||||||
|
|
||||||
|
module.exports = ({ config }) => {
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get('/', (req, res) => {
|
||||||
|
res.send({
|
||||||
|
name: config.siteTitle,
|
||||||
|
short_name: config.shortTitle,
|
||||||
|
background_color: 'white',
|
||||||
|
description: 'Sleek Wishlist App',
|
||||||
|
theme_color: '#dc5878',
|
||||||
|
start_url: '/',
|
||||||
|
display: 'standalone',
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
sizes: '1280x1280',
|
||||||
|
src: '/img/logo.png'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
return router;
|
||||||
|
};
|
|
@ -2,6 +2,10 @@ doctype html
|
||||||
html(lang='en')
|
html(lang='en')
|
||||||
head
|
head
|
||||||
meta(name='viewport', content='width=device-width, initial-scale=1')
|
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||||
|
|
||||||
|
link(rel='manifest', href='/manifest.json')
|
||||||
|
link(rel='apple-touch-icon', href='/img/logo.png', sizes='1280x1280')
|
||||||
|
|
||||||
if title
|
if title
|
||||||
title #{config.siteTitle} - #{title}
|
title #{config.siteTitle} - #{title}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue