Skip to content

Instantly share code, notes, and snippets.

@James1x0
Created May 27, 2016 16:46
Show Gist options
  • Save James1x0/0c6e82dd91c542f9b5cd82554a9067e7 to your computer and use it in GitHub Desktop.
Save James1x0/0c6e82dd91c542f9b5cd82554a9067e7 to your computer and use it in GitHub Desktop.

Each config gets called with:

  var mod = require(conf.directory);

  if ( conf.crud ) {
    methodMixins(mod, conf);
  }

  app.use(mount('/api/v1', Resource(conf.name, mod).middleware()));

conf.name ends up being paymentMethods

methodMixins are just the default crud ops for koa resource routers default middleware keys.

I make a call to GET /api/v1/payment-methods/exampleid and it doesn't call my middleware, instead returns 404, cannot get that route. Any other calls, ex. PUT /api/v1/payment-methods/exampleid, POST /api/v1/payment-methods, work. -_-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment