Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding handler.before_create/delete/update & after_create/delete/update #12

Closed
wants to merge 5 commits into from

Conversation

futurist
Copy link

@futurist futurist commented Jan 6, 2016

do you mind using co/Promise/generator to this lib? I've created this PR to be use as below:

handler.before_create = function(){
  return new Promise(function(resolve, reject){
    resolve()
    //reject('some thing wrong, cannot create')
  })
}

handler.after_create = function(err, doc, next){
  if(err) do_something()
  else do_something_with(doc)

  next && next()
}

@theninj4
Copy link
Contributor

Hi @futurist - I've extended the documentation in jsonapi-server to cover an example project layout. The example handler demonstrates how you might step in and tweak objects before/after a storage handler. I see it as more of a Javascript problem than a framework problem. https://github.com/holidayextras/jsonapi-server/blob/master/documentation/suggested-project-structure.md

@futurist
Copy link
Author

thank you! seems it is more standard way. will have a try.
Now the PR is far from the direction and more as a personal way, close for now

@futurist futurist closed this Jan 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants