rm middleware/error
This commit is contained in:
1 parent
bdf9b29f1e
commit
2ab341cd71
1 file changed
-18
@@ -1,18 +0,0 @@
|
||||
const {readFile} = require('async-file')
|
||||
const handlebars = require('handlebars')
|
||||
|
||||
function notFound(templateFile) {
|
||||
return async (ctx, next) => {
|
||||
await next()
|
||||
|
||||
if (ctx.status === 404) {
|
||||
const source = await readFile(templateFile, 'utf-8')
|
||||
const template = handlebars.compile(source)
|
||||
|
||||
ctx.type = 'text/html'
|
||||
ctx.body = template()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.notFound = notFound
|
||||
Reference in new issue
Block a user