add start script

This commit is contained in:
Jurgis Sakalauskas
2023-10-30 09:10:53 +02:00
parent f38803d60d
commit 1d7072aee0
11 changed files with 26 additions and 59 deletions
+3 -1
View File
@@ -8,7 +8,9 @@ export class RequestLogMiddleware implements NestMiddleware {
async use(req: Request, res: Response, next: NextFunction) {
const strIP = this.extractIp(req);
this.log(strIP + ' ' + req.method + ' ' + decodeURI(req.url));
console.log(decodeURI(req.url));
if (configService.isDev()) {
console.log(decodeURI(req.url));
}
next();
}
-19
View File
@@ -1,19 +0,0 @@
import { StaticService } from './static.service';
describe('StaticService', () => {
let staticService: StaticService;
beforeEach(() => {
staticService = new StaticService();
});
describe('provideDirIndex', () => {
it('should return file/dir list of dir', async () => {
jest.spyOn(staticService, 'provideDirIndex');
process.env.STATIC_SERVE_FOLDER = 'test/Static/_test-data/StaticServe';
const result = await staticService.provideDirIndex('');
expect(result).toHaveLength(2);
});
});
});
+4
View File
@@ -38,6 +38,10 @@ export class ConfigService {
public getRecentSearchesConfig(): RecentSearchesConfig {
return this.recentSearches;
}
public isDev(): boolean {
return this.getEnv('NODE_ENV') !== 'production';
}
}
export const configService = new ConfigService();