diff --git a/apps/api/.gitignore b/apps/api/.gitignore index 139637f..148449d 100644 --- a/apps/api/.gitignore +++ b/apps/api/.gitignore @@ -64,3 +64,5 @@ lerna-debug.log* !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + +.nestjs_repl_history diff --git a/apps/api/package.json b/apps/api/package.json index f2dfb1c..485ab09 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -9,7 +9,8 @@ "build": "nest build", "dev": "npm run start", "dev:debug": "npm run start:debug", - "start": "cross-env NODE_ENV=development nest start -w --path tsconfig.json -- ", + "repl": "npm run start -- --entryFile repl", + "start": "cross-env NODE_ENV=development nest start -w --path tsconfig.json", "start:debug": "cross-env NODE_ENV=development nest start --debug --watch", "start:prod": "cross-env NODE_ENV=production node dist/src/main", "prod": "cross-env NODE_ENV=production pm2-runtime start ecosystem.config.js", diff --git a/apps/api/src/repl.ts b/apps/api/src/repl.ts new file mode 100644 index 0000000..3aac090 --- /dev/null +++ b/apps/api/src/repl.ts @@ -0,0 +1,13 @@ +import { repl } from '@nestjs/core' + +import { AppModule } from './app.module' + +async function bootstrap() { + const replServer = await repl(AppModule) + replServer.setupHistory('.nestjs_repl_history', (err) => { + if (err) { + console.error(err) + } + }) +} +bootstrap()