I'm currently working on a Nest.js project and here is the content of the automobile.service.ts
file:
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Car } from './entities/car.entity';
import { Repository } from 'typeorm';
import { CreateAutoDto } from './dto/create-auto.dto';
import { UpdateAutoDto } from './dto/update-auto.dto';
export class AutoService {
constructor(
@InjectRepository(Car)
private autoRepository:Repository<Car>,
){}
create(createAutoDto: CreateAutoDto) {
return this.autoRepository.save(createAutoDto)
Currently, I am encountering an issue where after running nom run start:dev
in the terminal, the log stops at:
[Nest] 234 - 10/10/2021, 7:36:53 PM [NestFactory] Starting Nest application...
[Nest] 234 - 10/10/2021, 7:36:54 PM [InstanceLoader] TypeOrmModule dependencies initialized +958ms
From there, nothing further happens, preventing me from opening the page in the browser. Interestingly, if I remove the entire block:
constructor(
@InjectRepository(Car)
private autoRepository:Repository<Car>,
){}
The code compiles without any errors.
[Nest] 101 - 10/10/2021, 7:05:57 PM [NestApplication] Nest application successfully started +3ms
As a newcomer to Nest.js, I am trying to identify the root cause of this issue. Any insights?
EDIT:
In the file automobile.module.ts
import { AutoService } from './automobile.service';
import { AutoController } from './automobile.controller';
@Module({
controllers: [AutoController],
providers: [AutoService],
})
export class AutoModule {}