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
2017-07-08 14:18:15 +01:00

11 lines
442 B
TypeScript

import * as staticFile from 'connect-static-file';
import { Request, Response } from 'express';
import * as path from 'path';
export default function handle404(serveDir: string) {
const handle404Middleware = staticFile(path.join(serveDir, '.404.html'));
return function(request: Request, response: Response, next: () => void) {
response.statusCode = 404;
return handle404Middleware(request, response, next);
};
}