generated from fahricansecer/boilerplate-be
This commit is contained in:
19
test-api.ts
Normal file
19
test-api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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();
|
||||
Reference in New Issue
Block a user