How to use the @mojaloop/central-services-error-handling.validateRoutes function in @mojaloop/central-services-error-handling

To help you get started, we’ve selected a few @mojaloop/central-services-error-handling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mojaloop / central-ledger / src / shared / setup.js View on Github external
const server = await new Hapi.Server({
      port,
      cache: [
        {
          provider: {
            constructor: require('catbox-memory'),
            options: {
              partition: 'cache'
            }
          },
          name: 'memCache'
        }
      ],
      routes: {
        validate: {
          options: ErrorHandler.validateRoutes(),
          failAction: async (request, h, err) => {
            throw ErrorHandler.Factory.reformatFSPIOPError(err, ErrorHandler.Enums.FSPIOPErrorCodes.MALFORMED_SYNTAX)
          }
        }
      }
    })
    server.method({
      name: 'enums',
      method: getEnums,
      options: {
        cache: {
          cache: 'memCache',
          expiresIn: 5 * 60 * 1000,
          generateTimeout: 30 * 1000
        }
      }