Skip to content

Commit

Permalink
try relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
kamlekar committed May 3, 2023
1 parent 449fd97 commit 0f783b5
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
Expand Down
2 changes: 1 addition & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'path';
import path from 'path';

// @NOTE: If modifying these scopes, delete token.json.
export const SCOPES = [
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/authentication/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
Expand Down
2 changes: 1 addition & 1 deletion src/modules/authentication/services/googleAuth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/calendar/controllers/calendar.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class CalendarController {

this.watchService.watchCalendarEvents(authClient);

res.render('views/pages/slack/integrate.njk');
res.render('pages/slack/integrate.njk');
});
}
}
3 changes: 1 addition & 2 deletions src/modules/drive/controllers/drive.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(),
),
Expand Down

0 comments on commit 0f783b5

Please sign in to comment.