mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 03:58:02 -05:00
Move app.js to lib
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
8ce7b28563
commit
63095e6c78
1 changed files with 17 additions and 17 deletions
|
@ -20,11 +20,11 @@ var i18n = require('i18n')
|
||||||
var flash = require('connect-flash')
|
var flash = require('connect-flash')
|
||||||
|
|
||||||
// core
|
// core
|
||||||
var config = require('./lib/config')
|
var config = require('./config')
|
||||||
var logger = require('./lib/logger')
|
var logger = require('./logger')
|
||||||
var errors = require('./lib/errors')
|
var errors = require('./errors')
|
||||||
var models = require('./lib/models')
|
var models = require('./models')
|
||||||
var csp = require('./lib/csp')
|
var csp = require('./csp')
|
||||||
|
|
||||||
// server setup
|
// server setup
|
||||||
var app = express()
|
var app = express()
|
||||||
|
@ -64,7 +64,7 @@ io.engine.ws = new (require('ws').Server)({
|
||||||
})
|
})
|
||||||
|
|
||||||
// others
|
// others
|
||||||
var realtime = require('./lib/realtime.js')
|
var realtime = require('./realtime.js')
|
||||||
|
|
||||||
// assign socket io to realtime
|
// assign socket io to realtime
|
||||||
realtime.io = io
|
realtime.io = io
|
||||||
|
@ -155,7 +155,7 @@ server.on('resumeSession', function (id, cb) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// middleware which blocks requests when we're too busy
|
// 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())
|
app.use(flash())
|
||||||
|
|
||||||
|
@ -164,10 +164,10 @@ app.use(passport.initialize())
|
||||||
app.use(passport.session())
|
app.use(passport.session())
|
||||||
|
|
||||||
// check uri is valid before going further
|
// 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
|
// redirect url without trailing slashes
|
||||||
app.use(require('./lib/web/middleware/redirectWithoutTrailingSlashes'))
|
app.use(require('./web/middleware/redirectWithoutTrailingSlashes'))
|
||||||
app.use(require('./lib/web/middleware/codiMDVersion'))
|
app.use(require('./web/middleware/codiMDVersion'))
|
||||||
|
|
||||||
// routes need sessions
|
// routes need sessions
|
||||||
// template files
|
// template files
|
||||||
|
@ -206,13 +206,13 @@ app.locals.enableDropBoxSave = config.isDropboxEnable
|
||||||
app.locals.enableGitHubGist = config.isGitHubEnable
|
app.locals.enableGitHubGist = config.isGitHubEnable
|
||||||
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
|
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
|
||||||
|
|
||||||
app.use(require('./lib/web/baseRouter'))
|
app.use(require('./web/baseRouter'))
|
||||||
app.use(require('./lib/web/statusRouter'))
|
app.use(require('./web/statusRouter'))
|
||||||
app.use(require('./lib/web/auth'))
|
app.use(require('./web/auth'))
|
||||||
app.use(require('./lib/web/historyRouter'))
|
app.use(require('./web/historyRouter'))
|
||||||
app.use(require('./lib/web/userRouter'))
|
app.use(require('./web/userRouter'))
|
||||||
app.use(require('./lib/web/imageRouter'))
|
app.use(require('./web/imageRouter'))
|
||||||
app.use(require('./lib/web/note/router'))
|
app.use(require('./web/note/router'))
|
||||||
|
|
||||||
// response not found if no any route matxches
|
// response not found if no any route matxches
|
||||||
app.get('*', function (req, res) {
|
app.get('*', function (req, res) {
|
Loading…
Reference in a new issue