Skip to content

Commit

Permalink
chore: update playground link and global prefix /v1
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Jun 26, 2024
1 parent 37f6f1d commit 185f9b6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion cortex-js/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ export const getApp = async () => {
const app = await NestFactory.create(AppModule, {
snapshot: true,
cors: true,
logger: console
logger: console,
});

// Set the global prefix for the API /v1/
app.setGlobalPrefix('v1');

const fileService = app.get(FileManagerService);
await fileService.getConfig();

Expand Down
7 changes: 5 additions & 2 deletions cortex-js/src/infrastructure/commanders/serve.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SetCommandContext } from './decorators/CommandContext';
import { ServeStopCommand } from './sub-commands/serve-stop.command';
import { ContextService } from '../services/context/context.service';
import { getApp } from '@/app';
import { Logger } from '@nestjs/common';
import chalk from 'chalk';

type ServeOptions = {
address?: string;
Expand Down Expand Up @@ -37,7 +37,10 @@ export class ServeCommand extends CommandRunner {
const app = await getApp();

await app.listen(port, host);
console.log(`Started server at http://${host}:${port}`);
console.log(chalk.blue(`Started server at http://${host}:${port}`));
console.log(
chalk.blue(`API Playground available at http://${host}:${port}/api`),
);
}

@Option({
Expand Down
7 changes: 5 additions & 2 deletions cortex-js/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
defaultCortexJsPort,
} from '@/infrastructure/constants/cortex';
import { getApp } from './app';
import chalk from 'chalk';

async function bootstrap() {
const app = await getApp();
Expand All @@ -11,8 +12,10 @@ async function bootstrap() {
const port = process.env.CORTEX_JS_PORT || defaultCortexJsPort;

await app.listen(port, host);
console.log(`Started server at http://${host}:${port}`);
console.log(`Swagger UI available at http://${host}:${port}/api`);
console.log(chalk.blue(`Started server at http://${host}:${port}`));
console.log(
chalk.blue(`API Playground available at http://${host}:${port}/api`),
);
}

bootstrap();
1 change: 0 additions & 1 deletion cortex-js/src/usecases/models/models.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ export class ModelsUsecases {
metadata: {},
};
this.eventEmitter.emit('model.event', modelEvent);
console.error('Starting model failed', e.code, e.message, e.stack);
if (e.code === AxiosError.ERR_BAD_REQUEST) {
return {
message: 'Model already loaded',
Expand Down

0 comments on commit 185f9b6

Please sign in to comment.