#How can I modularize api endpoint clients module imports better?

6 messages · Page 1 of 1 (latest)

mild ingot
#

Hello, me and my coworker have just started toying around this framework and we ran into some little problem.
We would like to modularize endpoint service's modules so that we do not get conflicts when merging. I've tried with 'fs', modularizing into json files and it doesn't work because we're using webpack and everything gets compiled into the dist folder so we lose the reference to the file. Is there any way to make it so this:

      {
        name: 'USUARIOS_SERVICE',
        transport: Transport.RMQ,
        options: {
          urls: ['amqp://localhost:5672'],
          queue: 'usuarios_queue',
          queueOptions: {
            durable: true
          },
        },
      },
      {
        name: 'PRODUCTOS_SERVICE',
        transport: Transport.RMQ,
        options: {
          urls: ['amqp://localhost:5672'],
          queue: 'productos_queue',
          queueOptions: {
            durable: true
          },
        },
      },
    ]),
  ],```
could look like something like this?:
```    ClientsModule.register(servicesArray),```
but each one of those objects should be imported from different files dynamically and support webpack
mild ingot
#

anyone?

wispy cradle
#

I'm not sure I fully understand the reasoning here/what you're trying to achieve

mild ingot
#

when you register clientmodules, ypu pass an array of objects which are the options of each one of them. This makes that array very long. I would like to have it just read a folder, let's say you name it client-transport-imports (which inside would have multiple .ts files with these options) and use that instead of this array

#

and also have webpack working at the same time, the problem is the compiling

#

if I use 'fs' webpack doesn't compile the imports inside the /dist folder