From 73113dc361af070a91dd1d3e05e2345ab19a8608 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Mon, 15 Feb 2021 10:26:12 +0100 Subject: [PATCH] PublicApi: Add correct prefix Using nest-router for this purpose as it is a rather easy addition to our structure. As we don't add the Router to any e2e tests we don't need to change them. fixes #523 Signed-off-by: Philip Molares --- package.json | 5 +++-- src/app.module.ts | 9 +++++++++ yarn.lock | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f77fbc8f4..a96345eac 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,12 @@ "@nestjs/core": "7.6.12", "@nestjs/passport": "7.1.5", "@nestjs/platform-express": "7.6.12", - "@nestjs/swagger": "4.7.13", "@nestjs/schedule": "0.4.2", + "@nestjs/swagger": "4.7.13", "@nestjs/typeorm": "7.1.5", + "@types/bcrypt": "3.0.0", "@types/cron": "1.7.2", "@types/passport-http-bearer": "1.0.36", - "@types/bcrypt": "3.0.0", "bcrypt": "5.0.0", "class-transformer": "0.4.0", "class-validator": "0.13.1", @@ -42,6 +42,7 @@ "connect-typeorm": "1.1.4", "file-type": "16.2.0", "joi": "17.4.0", + "nest-router": "^1.0.9", "passport": "0.4.1", "passport-http-bearer": "1.0.1", "raw-body": "2.4.1", diff --git a/src/app.module.ts b/src/app.module.ts index 2f09ba425..f2cef930a 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -27,9 +27,18 @@ import databaseConfig from './config/database.config'; import authConfig from './config/auth.config'; import { PrivateApiModule } from './api/private/private-api.module'; import { ScheduleModule } from '@nestjs/schedule'; +import { RouterModule, Routes } from 'nest-router'; + +const routes: Routes = [ + { + path: '/api/v2', + module: PublicApiModule, + }, +]; @Module({ imports: [ + RouterModule.forRoutes(routes), TypeOrmModule.forRoot({ type: 'sqlite', database: './hedgedoc.sqlite', diff --git a/yarn.lock b/yarn.lock index 7ab6e9901..8d110ebdd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4961,6 +4961,11 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +nest-router@^1.0.9: + version "1.0.9" + resolved "https://registry.yarnpkg.com/nest-router/-/nest-router-1.0.9.tgz#cbe814dadf90b765e0a5b77c562479d5d523a485" + integrity sha512-ZyRdSVs9GczI+39B7tNXsxfBXQOYnEF6l/q2aLYG8wSEvRHRDXAlzZ1SIosDibM02pLahGkDNLFC+nZ8uzJGDQ== + next-tick@1, next-tick@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb"