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

Replace Restify with Express #80

Merged
merged 6 commits into from
May 9, 2016
Merged

Replace Restify with Express #80

merged 6 commits into from
May 9, 2016

Conversation

nwinch
Copy link
Contributor

@nwinch nwinch commented May 9, 2016

This branch resolves #5, #64 and #73.

Restify is gone. Long live Express!

A few things:

  • Middleware folder has been removed. There were two - CORS and JWT; CORS is now part of index, and JWT is now using express-jwt instead the existing custom implementation. Test files have been repurposed appropriately.
  • CORS generator has been removed as it's now part of /base.
  • Simple error middleware has been added, though this could probably be something more robust like kiss-my-error.

@davidbanham davidbanham self-assigned this May 9, 2016

fs.readdirSync('./middleware').map(name => {
require('./middleware/'+name)(app);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

How do middlewares get loaded if this function is removed?

Copy link
Contributor Author

@nwinch nwinch May 9, 2016

Choose a reason for hiding this comment

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

Yeah, I removed as this as after the cors and jwt middlewares were removed and now simply done with app.use, I figure if we - as authors - are adding anymore it'd be the same way; either application level middleware, or routing level middleware. Because there are no middleware generators, then there is no need to read and load them dynamically.

If a future redbeard user wants to add middleware, sure, they can add a separate folder for it if they so wish.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth having an opinion about where middleware should go. It saves people having to re-make that decision every time. They're still welcome to make a different decision, because it's just code that they can edit. If we give a sane default, though, they're not forced to.

Also, while we are no longer adding middleware as part of base we're still likely to want redbeard middleware in other generators. User is the main area that springs to mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, if you think it's still useful, I'll add it back in.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@davidbanham
Copy link
Contributor

In general, looks great! Nice work. I have two questions that I've asked in line comments.

@nwinch
Copy link
Contributor Author

nwinch commented May 9, 2016

@davidbanham Does my response on middleware make sense? If yes, I'mma merge this sucker.

@davidbanham
Copy link
Contributor

Will merge as soon as this passes CI.

@davidbanham davidbanham merged commit 657259c into master May 9, 2016
@nwinch nwinch deleted the express branch May 9, 2016 06:27
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.

Switch JWT library to use Asynchronous verify
2 participants