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

moved to connect-rest 2.0 #86

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@imrefazekas

imrefazekas commented Oct 1, 2016

Dear Ethan,
I moved the code to connect-rest 2.0. The very minimal to make it work, test ran without error.

@reybango

This comment has been minimized.

reybango commented Oct 1, 2016

@imrefazekas thanks for jumping here and making the changes. I'm sure @EthanRBrown will be happy too since he's working on the next edition of his book.

A couple of comments about this commit.

  • In his book, the context property for apiOptions uses a '/' but in your commit you've set it to an empty string. Was that a change to connect-rest in v2+?
  • Again in apiOptions, your commit removes the domain property which @EthanRBrown used to define a unique execution context for the api. Is there a better way to define that in connect-rest?
  • Your commit removes the apiOptions.domain.ondomain error handler which @EthanRBrown references in the book. Is there a better way to define that?

Again, thank you so much for jumping in and helping make the book even better and helping readers like myself leverage the updates.

};

var Rest = require('connect-rest');
let rest = Rest.create( apiOptions )

This comment has been minimized.

@EthanRBrown

EthanRBrown Mar 14, 2017

Owner

Why let here and var above? I'm all about const these days, but this book was written before it was easy to do all of that without transcompilation. This will all be pretty significantly different in the 2nd edition. Also, I'm not fond of unnecessary identifiers...other than calling create, you don't use Rest anywhere else. So I would write this as:

const rest = require('connect-rest').create({ context: '' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment