mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
Refactor code to remove unused imports and routes
This commit is contained in:
parent
caf3377cee
commit
a71190493a
@ -17,7 +17,6 @@ import HTTPResponse from 'Common/Types/API/HTTPResponse';
|
||||
import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse';
|
||||
import { StaticPath, ViewsPath } from './Utils/Config';
|
||||
import NotFoundUtil from './Utils/NotFound';
|
||||
import ServerErrorUtil from './Utils/ServerError';
|
||||
|
||||
// improt API
|
||||
import './API/BlogAPI';
|
||||
@ -1064,13 +1063,6 @@ const HomeFeatureSet: FeatureSet = {
|
||||
app.get('/*', (_req: ExpressRequest, res: ExpressResponse) => {
|
||||
return NotFoundUtil.renderNotFound(res);
|
||||
});
|
||||
|
||||
app.get(
|
||||
'/server-error',
|
||||
(_req: ExpressRequest, res: ExpressResponse) => {
|
||||
return ServerErrorUtil.renderServerError(res);
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -198,6 +198,42 @@ const init: InitFunction = async (
|
||||
});
|
||||
}
|
||||
|
||||
return app;
|
||||
};
|
||||
|
||||
const addDefaultRoutes: PromiseVoidFunction = async (): Promise<void> => {
|
||||
app.post('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.put('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.delete('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.get('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
// Attach Error Handler.
|
||||
app.use(
|
||||
(
|
||||
@ -252,42 +288,6 @@ const init: InitFunction = async (
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return app;
|
||||
};
|
||||
|
||||
const addDefaultRoutes: PromiseVoidFunction = async (): Promise<void> => {
|
||||
app.post('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.put('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.delete('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
|
||||
app.get('*', (req: ExpressRequest, res: ExpressResponse) => {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new NotFoundException('Not found')
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
export default { init, addDefaultRoutes };
|
||||
|
Loading…
Reference in New Issue
Block a user