Skip to content

Commit

Permalink
feat: add default route to all services
Browse files Browse the repository at this point in the history
  • Loading branch information
meysamhadeli committed Dec 13, 2023
1 parent 5823fda commit 9bae7a9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/booking/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const startupApp = async () => {

const app = express();

app.get('/', function (req, res) {
res.end(config.serviceName);
});

const logger = await initialLogger();

app.use(httpContextMiddleware);
Expand Down Expand Up @@ -51,7 +55,7 @@ const startupApp = async () => {
app.use(erroHandler);

app.listen(config.port, () => {
logger.info(`Listening to port ${config.port}`);
logger.info(`Listening to http://localhost:${config.port}`);
});

const rabbitmq = await initialRabbitmq();
Expand Down
6 changes: 5 additions & 1 deletion src/flight/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const startupApp = async () => {

const app = express();

app.get('/', function (req, res) {
res.end(config.serviceName);
});

const logger = await initialLogger();

app.use(httpContextMiddleware);
Expand Down Expand Up @@ -50,7 +54,7 @@ const startupApp = async () => {
app.use(erroHandler);

app.listen(config.port, () => {
logger.info(`Listening to port ${config.port}`);
logger.info(`Listening http://localhost:${config.port}`);
});

const rabbitmq = await initialRabbitmq();
Expand Down
18 changes: 11 additions & 7 deletions src/identity/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import helmet from 'helmet';
import compression from 'compression';
import cors from 'cors';
import passport from 'passport';
import { morganMiddleware } from 'building-blocks/logging/morgan';
import { RegisterRoutes } from './routes/routes';
import {morganMiddleware} from 'building-blocks/logging/morgan';
import {RegisterRoutes} from './routes/routes';
import config from 'building-blocks/config/config';
import { collectDefaultMetrics } from 'prom-client';
import { initialSwagger } from 'building-blocks/swagger/swagger';
import { erroHandler } from 'building-blocks/error-handler/erro-handler';
import {collectDefaultMetrics} from 'prom-client';
import {initialSwagger} from 'building-blocks/swagger/swagger';
import {erroHandler} from 'building-blocks/error-handler/erro-handler';
import {initialLogger} from "./extensions/logger.extensions";
import {initialDbContext} from "./data/db.context";
import {initialOpenTelemetry} from "./extensions/otel.extensions";
Expand All @@ -22,6 +22,10 @@ const startupApp = async () => {

const app = express();

app.get('/', function (req, res) {
res.end(config.serviceName);
});

const logger = await initialLogger();

app.use(httpContextMiddleware);
Expand All @@ -34,7 +38,7 @@ const startupApp = async () => {

app.use(express.json());

app.use(express.urlencoded({ extended: true }));
app.use(express.urlencoded({extended: true}));

app.use(compression());

Expand All @@ -50,7 +54,7 @@ const startupApp = async () => {
app.use(erroHandler);

app.listen(config.port, () => {
logger.info(`Listening to port ${config.port}`);
logger.info(`Listening to http://localhost:${config.port}`);
});

const rabbitmq = await initialRabbitmq();
Expand Down
6 changes: 5 additions & 1 deletion src/passenger/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const startupApp = async () => {

const app = express();

app.get('/', function (req, res) {
res.end(config.serviceName);
});

const logger = await initialLogger();

app.use(httpContextMiddleware);
Expand Down Expand Up @@ -50,7 +54,7 @@ const startupApp = async () => {
app.use(erroHandler);

app.listen(config.port, () => {
logger.info(`Listening to port ${config.port}`);
logger.info(`Listening to http://localhost:${config.port}`);
});

const rabbitmq = await initialRabbitmq();
Expand Down

0 comments on commit 9bae7a9

Please sign in to comment.