All checks were successful
Jenkins Production Deployment
Co-authored-by: Patrick Mueller <patrick@mueller-patrick.tech> Reviewed-on: #16 Co-authored-by: Patrick Müller <patrick@plutodev.de> Co-committed-by: Patrick Müller <patrick@plutodev.de>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
/**
|
|
* Required External Modules and Interfaces
|
|
*/
|
|
import express, {Request, Response} from 'express';
|
|
import {Guid} from 'guid-typescript';
|
|
import logger from '../../middleware/logger';
|
|
import {climbingGymRouter} from './climbing_gyms/climbingGyms.router';
|
|
import {climbingRoutesRouter} from './climbing_routes/climbingRoutes.router';
|
|
import {routeCommentsRouter} from './route_comments/routeComments.router';
|
|
import {routeRatingsRouter} from './route_ratings/routeRatings.router';
|
|
|
|
/**
|
|
* Router Definition
|
|
*/
|
|
export const crrRouter = express.Router();
|
|
|
|
// Sub-Endpoints
|
|
crrRouter.use('/gyms', climbingGymRouter);
|
|
crrRouter.use('/routes', climbingRoutesRouter);
|
|
crrRouter.use('/comments', routeCommentsRouter);
|
|
crrRouter.use('/ratings', routeRatingsRouter);
|
|
|
|
crrRouter.get('/', async (req: Request, res: Response) => {
|
|
try {
|
|
res.status(200).send('Pluto Development Climbing Route Rating API Endpoint');
|
|
} catch (e) {
|
|
let errorGuid = Guid.create().toString();
|
|
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
|
res.status(500).send({
|
|
'status': 'PROCESSING_ERROR',
|
|
'message': 'Internal Server Error. Try again later.',
|
|
'reference': errorGuid
|
|
});
|
|
}
|
|
});
|