Created
          January 13, 2022 13:28 
        
      - 
      
 - 
        
Save yeungon/14cc81568c6a00398ee6027300a7d356 to your computer and use it in GitHub Desktop.  
    appmodule - nestjs
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @Module({ | |
| imports: [ | |
| StoresModule, | |
| UserModule, | |
| TypeOrmModule.forRoot({ | |
| type: 'mysql', | |
| // "db" is the name of the service declared in docker-compose.yml, NOT localhost https://stackoverflow.com/questions/63492744/dockerize-nestjs-and-typeorm | |
| host: 'db', | |
| port: 3306, | |
| username: 'root', | |
| password: 'changeme', | |
| database: 'admin', | |
| //https://orkhan.gitbook.io/typeorm/docs/connection-options#mysql-mariadb-connection-options | |
| //https://github.com/typeorm/typeorm/issues/390#issuecomment-292452066 | |
| charset: 'utf8mb4', //seem cannot set the charset for mysql here!!! | |
| // For development only | |
| autoLoadEntities: true, | |
| synchronize: true, | |
| }), | |
| ], | |
| controllers: [AppController], | |
| providers: [AppService], | |
| }) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment