refactor: server code (#2545)

+ Remove duplicated await
+ Replace some legacy codes with ES6
+ Fix some of eslint problems
This commit is contained in:
Jafar Akhondali
2020-10-14 18:46:27 +03:30
committed by GitHub
parent 0a1f0ac9e3
commit 5ba36ee421
12 changed files with 27 additions and 39 deletions

View File

@@ -26,8 +26,8 @@ module.exports = async () => {
// Load middlewares
// ----------------------------------------
var mw = autoload(path.join(WIKI.SERVERPATH, '/middlewares'))
var ctrl = autoload(path.join(WIKI.SERVERPATH, '/controllers'))
const mw = autoload(path.join(WIKI.SERVERPATH, '/middlewares'))
const ctrl = autoload(path.join(WIKI.SERVERPATH, '/controllers'))
// ----------------------------------------
// Define Express App
@@ -169,7 +169,7 @@ module.exports = async () => {
// ----------------------------------------
app.use((req, res, next) => {
var err = new Error('Not Found')
const err = new Error('Not Found')
err.status = 404
next(err)
})