mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
style(): update formatting, minor changes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { ExpressAdapter } from '@nestjs/platform-express';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as express from 'express';
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { randomPort } from './utils';
|
||||
|
||||
describe('Get-Url (Express Application)', () => {
|
||||
describe('Get URL (Express Application)', () => {
|
||||
let testModule: TestingModule;
|
||||
let port: number;
|
||||
|
||||
@@ -42,7 +42,9 @@ describe('Get-Url (Express Application)', () => {
|
||||
try {
|
||||
await app.getUrl();
|
||||
} catch (err) {
|
||||
expect(err).to.be.eql('app.listen needs to be called before calling app.getUrl');
|
||||
expect(err).to.be.eql(
|
||||
'app.listen needs to be called before calling app.getUrl',
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FastifyAdapter } from '@nestjs/platform-fastify';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { randomPort } from './utils';
|
||||
|
||||
describe('Get-Url (Fastify Application)', () => {
|
||||
describe('Get URL (Fastify Application)', () => {
|
||||
let testModule: TestingModule;
|
||||
let port: number;
|
||||
|
||||
@@ -35,7 +35,9 @@ describe('Get-Url (Fastify Application)', () => {
|
||||
try {
|
||||
await app.getUrl();
|
||||
} catch (err) {
|
||||
expect(err).to.be.eql('app.listen needs to be called before calling app.getUrl');
|
||||
expect(err).to.be.eql(
|
||||
'app.listen needs to be called before calling app.getUrl',
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,4 +14,4 @@ export async function randomPort(): Promise<number> {
|
||||
resolve(port);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ import { AppService } from './app.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.appService.sayHello();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ import { AppService } from './app.service';
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule {}
|
||||
export class AppModule {}
|
||||
|
||||
@@ -5,4 +5,4 @@ export class AppService {
|
||||
sayHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ export const MESSAGES = {
|
||||
MICROSERVICE_READY: `Nest microservice successfully started`,
|
||||
UNKNOWN_EXCEPTION_MESSAGE: 'Internal server error',
|
||||
ERROR_DURING_SHUTDOWN: 'Error happened during shutdown',
|
||||
CALL_LISTEN_FIRST: 'app.listen needs to be called before calling app.getUrl',
|
||||
CALL_LISTEN_FIRST:
|
||||
'app.listen() needs to be called before calling app.getUrl()',
|
||||
};
|
||||
|
||||
export const APP_INTERCEPTOR = 'APP_INTERCEPTOR';
|
||||
|
||||
@@ -15,6 +15,7 @@ import { Logger } from '@nestjs/common/services/logger.service';
|
||||
import { loadPackage } from '@nestjs/common/utils/load-package.util';
|
||||
import { isObject, validatePath } from '@nestjs/common/utils/shared.utils';
|
||||
import iterate from 'iterare';
|
||||
import { platform } from 'os';
|
||||
import { AbstractHttpAdapter } from './adapters';
|
||||
import { ApplicationConfig } from './application-config';
|
||||
import { MESSAGES } from './constants';
|
||||
@@ -25,7 +26,6 @@ import { MiddlewareModule } from './middleware/middleware-module';
|
||||
import { NestApplicationContext } from './nest-application-context';
|
||||
import { Resolver } from './router/interfaces/resolver.interface';
|
||||
import { RoutesResolver } from './router/routes-resolver';
|
||||
import { platform } from 'os';
|
||||
|
||||
const { SocketModule } = optionalRequire(
|
||||
'@nestjs/websockets/socket-module',
|
||||
@@ -269,18 +269,6 @@ export class NestApplication extends NestApplicationContext
|
||||
});
|
||||
}
|
||||
|
||||
private host(): string | undefined {
|
||||
const address = this.httpServer.address();
|
||||
if (typeof address === 'string') {
|
||||
return undefined;
|
||||
}
|
||||
return address && address.address;
|
||||
}
|
||||
|
||||
private getProtocol(): 'http' | 'https' {
|
||||
return this.appOptions && this.appOptions.httpsOptions ? 'https' : 'http';
|
||||
}
|
||||
|
||||
public setGlobalPrefix(prefix: string): this {
|
||||
this.config.setGlobalPrefix(prefix);
|
||||
return this;
|
||||
@@ -329,6 +317,17 @@ export class NestApplication extends NestApplicationContext
|
||||
this.httpAdapter.setViewEngine(engineOrOptions);
|
||||
return this;
|
||||
}
|
||||
private host(): string | undefined {
|
||||
const address = this.httpServer.address();
|
||||
if (typeof address === 'string') {
|
||||
return undefined;
|
||||
}
|
||||
return address && address.address;
|
||||
}
|
||||
|
||||
private getProtocol(): 'http' | 'https' {
|
||||
return this.appOptions && this.appOptions.httpsOptions ? 'https' : 'http';
|
||||
}
|
||||
|
||||
private async registerMiddleware(instance: any) {
|
||||
await this.middlewareModule.registerMiddleware(
|
||||
|
||||
Reference in New Issue
Block a user