console.log('Welcome to Moustacheminer Server Services');

const config = require('config');
const express = require('express');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const engines = require('consolidate');
const path = require('path');
const request = require('request');
const cors = require('cors');
const i18n = require('i18n');
const discord = require('./discord');
const api = require('./api');
const docs = require('./docs');
const url = require('./url');
const mail = require('./mail');
const lang = require('./lang');
const session = require('express-session');

const app = express();

i18n.configure({
	directory: path.join(__dirname, '..', 'locales'),
	cookie: 'lang',
	defaultLocale: 'en-gb',
	autoReload: true,
	updateFiles: false
});

app.locals.name = config.get('name');

// Middleware
app.enable('trust proxy')
	.use(bodyParser.json({
		limit: '20mb'
	}))
	.use(bodyParser.urlencoded({
		extended: true,
		limit: '20mb'
	}))
	.use(cookieParser(config.get('webserver').secret))
	.use(session({
		secret: config.get('webserver').secret,
		resave: true,
		saveUninitialized: true,
		proxy: true
	}))
	.use(i18n.init)
	.set('views', path.join(__dirname, '/dynamic'))
	.engine('html', engines.pug)
	.set('view engine', 'html')
	.use(cors())
	.get('/', (req, res) => {
		request({
			method: 'GET',
			url: `https://api:${config.get('api').mailgun.apiKey}@api.mailgun.net/v3/${config.get('api').mailgun.domain}/stats/total?event=accepted&event=delivered&resolution=month`,
			json: true
		}, (err, response, body) => {
			let incoming = null;
			let outgoing = null;

			if (err || response.statusCode !== 200) {
				incoming = 'Error';
				outgoing = 'Error';
			} else {
				incoming = body.stats.reduce((total, time) => total + time.accepted.incoming, 0);
				outgoing = body.stats.reduce((total, time) => total + time.accepted.outgoing, 0);
			}

			res.status(200).render('index.pug', {
				discord,
				incoming,
				outgoing
			});
		});
	})
	.use('/api', api)
	.use('/docs', docs)
	.use('/url', url)
	.use('/mail', mail)
	.use('/lang', lang)
	.use(express.static(path.join(__dirname, '/static')))
	.use('*', (req, res) => res.status(404).render('error.pug', { status: 404 }));

console.log('Listening on', config.get('webserver').port);
app.listen(config.get('webserver').port);

@@ -751,16 +751,53 @@
 en-gb',%0A
+%09fallbacks: %7B%0A%09%09'zh-hk': 'en-gb'%0A%09%7D,%0A
 %09autoRel

Add fallback for zh-hk