feat: register service to api gateway.
This commit is contained in:
@@ -5,6 +5,7 @@ import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { HttpExceptionFilter } from './commons/filters/all.exception-filter';
|
||||
import { SanitizePipe } from './commons/pipes/sanitize.pipe';
|
||||
import { ServiceRegister } from 'configuration';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, { bodyParser: false });
|
||||
@@ -17,6 +18,10 @@ async function bootstrap() {
|
||||
);
|
||||
const httpExceptionFilterLogger = await app.resolve(PinoLogger);
|
||||
app.useGlobalFilters(new HttpExceptionFilter(httpExceptionFilterLogger));
|
||||
await app.listen(configService.get<number>('http.port'));
|
||||
const server = await app.listen(configService.get<number>('http.port', 0));
|
||||
const port = server.address().port;
|
||||
const register = new ServiceRegister({ etcd: { hosts: 'http://rpi:2379' } });
|
||||
register.register('fennec/api', `http://localhost:${port}`);
|
||||
register.register('api.fennec', `http://localhost:${port}`);
|
||||
}
|
||||
bootstrap();
|
||||
|
Reference in New Issue
Block a user