Vincit/dodo.js

Way to create service where all code / routes / migrations comes from npm dependency

Opened this issue · 0 comments

These would be maybe some things called pluggable services.

One would just need to add e.g. dodo-services-stripey-payment and maybe add one liner somewhere e.g. to gulp file to tell system to use that.

It will register new task, which allows to create new service to services directory, which contains configuration file. However configuration file will refer directly paths under node_modules (migrations / populate data / routes etc.)

Paths could be exposed by plugin module the same way that normal plugins exposes paths to features, so in pluggable service configuration it would just refer paths got from require to prevent directly use of nasty ../../node_modules/... relative paths.

module.exports = {
  port: process.env.PORT || 8083,
  features: [
    {
      feature: 'objection',
      config: {
        knex: {
          connection: {
            database: 'stripey-payments'
          },
          migrations: {
            directory: paymentService.migrationsPath
          }
        },
        modelPaths: paymentService.modelPaths
      }
    }, {
      feature: 'route',
      config: {
        routePaths: paymentService.routePaths
      }
    }
  ]
};