personal-api/plugin-instagram

Factor out success handlers currently duplicated from the project core

chrisvogt opened this issue · 1 comments

I added copypasta of the current @personal-api/core success handler because I was bikeshedding over multiple solutions.

const sendSuccess = (res, result) => {
const response = {};
response.status = 'ok';
response.result = result;
res.type('json');
res.status = 200;
res.json(response);
};

The solutions I've been weighing are:

  1. Pass in the success and error handlers. The plugin won't need to have any knowledge of the handlers.
  2. Import a module containing the error handlers. The plugin will need to maintain the handlers as a versioned dependency.
  3. ?