I don't see any status or console messages in the IDE console while trying to hit any end-point. I do see the response getting returned but no call details in the console. I am confused as why is it behaving this way?
Following is what I see on running npm run-script start:dev -
> nest start --watch
[3:04:44 PM] Starting compilation in watch mode...
[Nest] 14340 - 05/20/2020, 3:10:58 PM [NestFactory] Starting Nest application...
[Nest] 14340 - 05/20/2020, 3:10:58 PM [InstanceLoader] TypeOrmModule dependencies initialized +220ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [InstanceLoader] TypeOrmCoreModule dependencies initialized +195ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [InstanceLoader] TypeOrmModule dependencies initialized +6ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [InstanceLoader] AppModule dependencies initialized +5ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RoutesResolver] AppController {}: +13ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {, GET} route +4ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RoutesResolver] BatchController {/batch}: +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/batch, POST} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/batch, GET} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/batch/:batch, GET} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/batch/:batch, DELETE} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RoutesResolver] StudentController {/student}: +0ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/student, POST} route +2ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/student, GET} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/student/:id, GET} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:58 PM [RouterExplorer] Mapped {/student/:id, DELETE} route +2ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RoutesResolver] AssignmentController {/assignment}: +1ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RouterExplorer] Mapped {/assignment, POST} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RouterExplorer] Mapped {/assignment, GET} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RouterExplorer] Mapped {/assignment/:id, GET} route +2ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RouterExplorer] Mapped {/assignment/:id, DELETE} route +1ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RoutesResolver] UploadController {/upload}: +1ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [RouterExplorer] Mapped {/upload, POST} route +2ms
[Nest] 14340 - 05/20/2020, 3:10:59 PM [NestApplication] Nest application successfully started +3ms
When I hit http://localhost:3000/batch, I see the response but the console above doesn't display anything like API type GET or status 200 etc.
This is what I have in controller -
import {
Controller,
Get,
Post,
Body,
Param,
Delete,
Logger,
} from '@nestjs/common';
import { BatchService } from './batch.service';
import { Batch } from './batch.entity';
import { InsertResult } from 'typeorm';
@Controller('batch')
export class BatchController {
private readonly logger = new Logger(BatchController.name);
constructor(private batchService: BatchService) {}
@Post()
create(@Body() batchDto: Batch): Promise<InsertResult> {
this.logger.log(':: BatchController :: create()');
console.log(':: BatchController :: create()');
return this.batchService.create(batchDto);
}
@Get()
findAll(): Promise<Batch[]> {
this.logger.log(':: BatchController :: findAll()');
console.log(':: BatchController :: findAll()');
return this.batchService.findAll();
}
@Get(':batch')
findOne(@Param('batch') batchName): Promise<Batch> {
this.logger.log(':: BatchController :: findOne()');
console.log(':: BatchController :: findOne()');
return this.batchService.findOne(batchName);
}
@Delete(':batch')
remove(@Param('batch') batchName) {
this.logger.log(':: BatchController :: remove()');
console.log(':: BatchController :: remove()');
return this.batchService.remove(batchName);
}
}
Put the console and logger both as to see if anything works.