diff --git a/App/FeatureSet/Home/Index.ts b/App/FeatureSet/Home/Index.ts index 5d6add93e1..f38461faaa 100755 --- a/App/FeatureSet/Home/Index.ts +++ b/App/FeatureSet/Home/Index.ts @@ -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); - } - ); }, }; diff --git a/CommonServer/Utils/StartServer.ts b/CommonServer/Utils/StartServer.ts index 06ff3843a1..94be23c158 100644 --- a/CommonServer/Utils/StartServer.ts +++ b/CommonServer/Utils/StartServer.ts @@ -198,6 +198,42 @@ const init: InitFunction = async ( }); } + return app; +}; + +const addDefaultRoutes: PromiseVoidFunction = async (): Promise => { + 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 => { - 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 };