refactor: renderers + auth providers + fixes
This commit is contained in:
@@ -29,7 +29,6 @@ module.exports = async () => {
|
||||
const path = require('path')
|
||||
const session = require('express-session')
|
||||
const SessionRedisStore = require('connect-redis')(session)
|
||||
// const graceful = require('node-graceful')
|
||||
const graphqlApollo = require('apollo-server-express')
|
||||
const graphqlSchema = require('./modules/graphql')
|
||||
|
||||
@@ -106,7 +105,6 @@ module.exports = async () => {
|
||||
app.locals.moment = require('moment')
|
||||
app.locals.moment.locale(wiki.config.site.lang)
|
||||
app.locals.config = wiki.config
|
||||
app.use(mw.flash)
|
||||
|
||||
// ----------------------------------------
|
||||
// Controllers
|
||||
@@ -126,21 +124,20 @@ module.exports = async () => {
|
||||
})(req, res, next)
|
||||
})
|
||||
app.use('/graphiql', graphqlApollo.graphiqlExpress({ endpointURL: '/graphql' }))
|
||||
// app.use('/uploads', mw.auth, ctrl.uploads)
|
||||
app.use('/admin', mw.auth, ctrl.admin)
|
||||
app.use('/', mw.auth, ctrl.pages)
|
||||
|
||||
app.use('/', mw.auth, ctrl.common)
|
||||
|
||||
// ----------------------------------------
|
||||
// Error handling
|
||||
// ----------------------------------------
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req, res, next) => {
|
||||
var err = new Error('Not Found')
|
||||
err.status = 404
|
||||
next(err)
|
||||
})
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
app.use((err, req, res, next) => {
|
||||
res.status(err.status || 500)
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
@@ -180,17 +177,5 @@ module.exports = async () => {
|
||||
wiki.logger.info('HTTP Server: [ RUNNING ]')
|
||||
})
|
||||
|
||||
// ----------------------------------------
|
||||
// Graceful shutdown
|
||||
// ----------------------------------------
|
||||
|
||||
// graceful.on('exit', () => {
|
||||
// wiki.logger.info('- SHUTTING DOWN - Performing git sync...')
|
||||
// return global.git.resync().then(() => {
|
||||
// wiki.logger.info('- SHUTTING DOWN - Git sync successful. Now safe to exit.')
|
||||
// process.exit()
|
||||
// })
|
||||
// })
|
||||
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user