Skip to content

Conversation

@arjansingh
Copy link
Contributor

I just thought I'd start the review.

Requires ember-fastboot/fastboot-express-middleware#11 before we can merge.

package.json Outdated
"express": "^4.13.3",
"fastboot": "^1.0.0-rc.0",
"fastboot-express-middleware": "^1.0.0-rc.3",
"fastboot-express-middleware": "dollarshaveclub/fastboot-express-middleware#b975bb3",
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be updated to a released version before merge.

});

it("executes preFastbootMiddlewares", function() {
return runServer('prefastboot-middleware-server')
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed at the meeting this week that the API for this should be to expose pre-FastBoot middleware and post-FastBoot middleware callbacks that yield the Express app itself. This is a more flexible API that is not limited to just middleware, and lets folks use the Express API they're already familiar with instead of learning something custom to the FastBoot App Server.


this.preFastbootMiddlewares(app);

if (this.gzip) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to move this code to get the execution order right.

let username = this.username;
let password = this.password;

this.preFastbootMiddlewares(app);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomdale Since app.use is synchronous way of binding callbacks all we need to do is pass the app instance into these hooks.

res.send();
}

var server = new FastBootAppServer({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tomdale this pattern would be how you would use the middleware hooks.

README.md Outdated

const server = FastBootAppServer({
preFastbootMiddlewares: function (app) { app.use(modifyRequest); },
postFastbootMiddlewares: function (app) { app.use(handleErrors); }
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little verbose, and I think middleware is an irregular plural, right? "Middlewares" sounds strange to me.

Maybe something like:

  • beforeMiddleware
  • afterMiddleware
    ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should do it

@tomdale
Copy link
Contributor

tomdale commented Oct 22, 2016

This is awesome. Thank you @arjansingh!

@tomdale tomdale merged commit 26df1c0 into ember-fastboot:master Oct 22, 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.

3 participants