Skip to content

moved to connect-rest 2.0 - #86

Open
imrefazekas wants to merge 1 commit into
EthanRBrown:masterfrom
imrefazekas:master
Open

moved to connect-rest 2.0#86
imrefazekas wants to merge 1 commit into
EthanRBrown:masterfrom
imrefazekas:master

Conversation

@imrefazekas

Copy link
Copy Markdown

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

@reybango

reybango commented Oct 1, 2016

Copy link
Copy Markdown

@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.

Comment thread ch15/meadowlark.js
};

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants