diff --git a/src/app.controller.ts b/src/app.controller.ts index 9ee7e02..29560e0 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -14,7 +14,7 @@ export class AppController { } catch (ex) { requiredAuth = true; } - res.render('views/pages/index.njk', { + res.render('pages/index.njk', { authUrl: this.googleAuthService.generateAuthUrl( await this.googleAuthService.getAuthClient(), ), diff --git a/src/common/constants.ts b/src/common/constants.ts index 8de1bec..898f5de 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -1,4 +1,4 @@ -import * as path from 'path'; +import path from 'path'; // @NOTE: If modifying these scopes, delete token.json. export const SCOPES = [ diff --git a/src/main.ts b/src/main.ts index 3b14824..b2c46ed 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,14 +1,14 @@ /* eslint-disable @typescript-eslint/no-var-requires */ import { NestFactory } from '@nestjs/core'; import { NestExpressApplication } from '@nestjs/platform-express'; -import { join } from 'path'; +import path from 'path'; import { AppModule } from './app.module'; import * as dotenv from 'dotenv'; import * as fs from 'fs'; import * as os from 'os'; import fileUpload from 'express-fileupload'; -import * as nunjucks from 'nunjucks'; +import nunjucks from 'nunjucks'; import { ROOT_DIR } from './common/constants'; dotenv.config(); @@ -44,7 +44,7 @@ async function bootstrap() { noCache: !IS_PRODUCTION, }; - nunjucks.configure(join(IS_PRODUCTION ? 'dist' : 'src'), opts); + nunjucks.configure(path.resolve(__dirname, 'views'), opts); app.enableCors(); app.set('trust proxy', 1); diff --git a/src/modules/authentication/controllers/auth.controller.ts b/src/modules/authentication/controllers/auth.controller.ts index 0ab362e..3bf9a70 100644 --- a/src/modules/authentication/controllers/auth.controller.ts +++ b/src/modules/authentication/controllers/auth.controller.ts @@ -26,7 +26,7 @@ export class AuthController { @Get('/auth') async goToAuth(@Res() res: Response) { - res.render('views/pages/authenticate/index.njk', { + res.render('pages/authenticate/index.njk', { authUrl: this.googleAuthService.generateAuthUrl( await this.googleAuthService.getAuthClient(), ), diff --git a/src/modules/authentication/services/googleAuth.service.ts b/src/modules/authentication/services/googleAuth.service.ts index 4fc6e5b..a98285f 100644 --- a/src/modules/authentication/services/googleAuth.service.ts +++ b/src/modules/authentication/services/googleAuth.service.ts @@ -9,7 +9,7 @@ import { CREDENTIALS_PATH, SCOPES } from '../../../common/constants'; import * as fs from 'fs'; import * as url from 'url'; import * as os from 'os'; -import * as path from 'path'; +import path from 'path'; @Injectable() export class GoogleAuthService { diff --git a/src/modules/calendar/controllers/calendar.controller.ts b/src/modules/calendar/controllers/calendar.controller.ts index 0ea0f52..3947f7c 100644 --- a/src/modules/calendar/controllers/calendar.controller.ts +++ b/src/modules/calendar/controllers/calendar.controller.ts @@ -36,7 +36,7 @@ export class CalendarController { this.watchService.watchCalendarEvents(authClient); - res.render('views/pages/slack/integrate.njk'); + res.render('pages/slack/integrate.njk'); }); } } diff --git a/src/modules/drive/controllers/drive.controller.ts b/src/modules/drive/controllers/drive.controller.ts index 95ccbf1..e71c98d 100644 --- a/src/modules/drive/controllers/drive.controller.ts +++ b/src/modules/drive/controllers/drive.controller.ts @@ -2,7 +2,6 @@ import { Controller, Get, Post, Req, Res } from '@nestjs/common'; import { UploadService } from '../services/upload.service'; import { Request, Response } from 'express-serve-static-core'; import { GoogleAuthService } from '../../authentication/services/googleAuth.service'; -import { ROOT_DIR } from '../../../common/constants'; @Controller() export class DriveController { @@ -20,7 +19,7 @@ export class DriveController { requiredAuth = true; } - res.render('views/pages/drive/upload.njk', { + res.render('pages/drive/upload.njk', { authUrl: this.googleAuthService.generateAuthUrl( await this.googleAuthService.getAuthClient(), ),