0.1.1 • Published 4 years ago

mysql2-nestjs v0.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

MySql2 Combined with nestjs

For more detail look at MySql2

@Module({
  imports: [
    NestMysql2Module.register({
      host: "localhost",
      port: 30006,
      user: "root",
      password: "example"
    })
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }

Then in your controller:

constructor(
    @InjectMysql()
    private readonly mysql: Mysql
  ) { }
const [result, fields] = await this.mysql.query("SELECT 1+2");