This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
tstatic/src/middleware/404.ts

12 lines
443 B
TypeScript
Raw Normal View History

2017-02-15 07:32:19 +00:00
import { Request, Response } from 'express';
2017-02-19 21:53:06 +00:00
import * as staticFile from 'connect-static-file'
import * as path from 'path';
2017-02-15 07:32:19 +00:00
export default function handle404(serveDir : string) {
const handle404Middleware = staticFile(path.join(serveDir, '.404.html'));
return function (request : Request, response : Response, next : Function) {
response.statusCode = 404;
return handle404Middleware(request, response, next);
}
}