archive
/
tstatic
Archived
1
Fork 0
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
437 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 (request: Request, response: Response, next: () => void) => {
response.statusCode = 404;
return handle404Middleware(request, response, next);
};
}