generated from fahricansecer/boilerplate-be
20 lines
785 B
TypeScript
20 lines
785 B
TypeScript
// test-api.ts
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { AppModule } from './src/app.module';
|
|
import { MasterContentService } from './src/modules/content/services/master-content.service';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.createApplicationContext(AppModule);
|
|
const masterContentService = app.get(MasterContentService);
|
|
|
|
// Fetch a known master ID from the DB
|
|
const id = '80c71d39-4614-426c-9d9a-e5b2301cdebd';
|
|
const data = await masterContentService.getById(id);
|
|
console.log("Returned data type:", typeof data);
|
|
console.log("Has contents?", Array.isArray(data?.contents));
|
|
console.log("Contents array:", data?.contents?.map(c => ({ id: c.id, type: c.type, title: c.title })));
|
|
|
|
await app.close();
|
|
}
|
|
bootstrap();
|