Search code examples
spring-bootnestjsnetflix-eureka

How to register Nestjs project with Spring Eureka


I'am begginer with nest js and I would like to know how to implement eureka client discovery with nest js. I saw this dependency https://www.npmjs.com/package/nestjs-eureka exists but there is no example of any implementation


Solution

  • Add Eureka Module to app.module imports:[]

    EurekaModule.forRoot({
        disable: false,
        disableDiscovery: false,
        eureka: {
            host: process.env.EUREKA_HOST || 'eureka-server',
            port: process.env.EUREKA_PORT || 80,
            servicePath: '/eureka/apps',
            maxRetries: 10,
            requestRetryDelay: 10000,
        },
        service: {
            name: 'nest-service',
            port: parseInt(process.env.APP_PORT) || 3000,
        },
    }),