Move app.js to lib

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2019-11-23 21:02:33 +01:00 committed by Sheogorath
parent 8ce7b28563
commit 63095e6c78
No known key found for this signature in database
GPG key ID: C9B1C80737B9CE18

View file

@ -20,11 +20,11 @@ var i18n = require('i18n')
var flash = require('connect-flash')
// core
var config = require('./lib/config')
var logger = require('./lib/logger')
var errors = require('./lib/errors')
var models = require('./lib/models')
var csp = require('./lib/csp')
var config = require('./config')
var logger = require('./logger')
var errors = require('./errors')
var models = require('./models')
var csp = require('./csp')
// server setup
var app = express()
@ -64,7 +64,7 @@ io.engine.ws = new (require('ws').Server)({
})
// others
var realtime = require('./lib/realtime.js')
var realtime = require('./realtime.js')
// assign socket io to realtime
realtime.io = io
@ -155,7 +155,7 @@ server.on('resumeSession', function (id, cb) {
})
// middleware which blocks requests when we're too busy
app.use(require('./lib/web/middleware/tooBusy'))
app.use(require('./web/middleware/tooBusy'))
app.use(flash())
@ -164,10 +164,10 @@ app.use(passport.initialize())
app.use(passport.session())
// check uri is valid before going further
app.use(require('./lib/web/middleware/checkURIValid'))
app.use(require('./web/middleware/checkURIValid'))
// redirect url without trailing slashes
app.use(require('./lib/web/middleware/redirectWithoutTrailingSlashes'))
app.use(require('./lib/web/middleware/codiMDVersion'))
app.use(require('./web/middleware/redirectWithoutTrailingSlashes'))
app.use(require('./web/middleware/codiMDVersion'))
// routes need sessions
// template files
@ -206,13 +206,13 @@ app.locals.enableDropBoxSave = config.isDropboxEnable
app.locals.enableGitHubGist = config.isGitHubEnable
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
app.use(require('./lib/web/baseRouter'))
app.use(require('./lib/web/statusRouter'))
app.use(require('./lib/web/auth'))
app.use(require('./lib/web/historyRouter'))
app.use(require('./lib/web/userRouter'))
app.use(require('./lib/web/imageRouter'))
app.use(require('./lib/web/note/router'))
app.use(require('./web/baseRouter'))
app.use(require('./web/statusRouter'))
app.use(require('./web/auth'))
app.use(require('./web/historyRouter'))
app.use(require('./web/userRouter'))
app.use(require('./web/imageRouter'))
app.use(require('./web/note/router'))
// response not found if no any route matxches
app.get('*', function (req, res) {