Nest.js - nest cli is not picking up the latest file changes

Viewed 467

I wrote a very basic controller like

@Controller('tasks')
export class TasksController {

  constructor(private tasksService: TasksService) {}

  @Get(':id')
  getById(@Param('id') id: string): TaskDto {
    console.log('Get Called>>>', id);
    const task = this.tasksService.getById(id);
    const dto = TaskMapper.toDto(task);

    return dto;
  }

  @Delete(':id')
  remove(@Param('id') id: string): void {
    console.log('Delete Called>>>', id);
    this.tasksService.remove(id);
  }
}

I'm using the following URI to call each endpoint via Postman (also tried with the Powershell) with their respective METHOD GET, DELETE.

http://localhost:3000/tasks/83b213a0-8cbf-46e0-a484-e3df7f216e2f

Now, the strangest thing is that CLI is somehow got stuck at one version of the Controller file. Now even if I delete the whole controller, the cli is still mapping the different methods of the Controller.

I've tried different methods of starting the application via various yarn, npm and directly nest commands but nothing seems to pick up the latest file changes.

I've gone through the whole code a zillion times but unable to pinpoint the issue!

1 Answers

Finally got it working, solution was to delete the "dist" folder.

But I still don't understand why this problem occurred in the first place!!

Related