MozillaFoundation / engineering-handbook

Mozilla Foundation's Engineering Handbook
https://mozillafoundation.github.io/engineering-handbook/
13 stars 11 forks source link

the stack chapter #23

Closed Pomax closed 7 years ago

Pomax commented 9 years ago

fixes #16

jbuck commented 9 years ago

I'd love to see us move away from using Express and towards Hapi for everything.

Pomax commented 9 years ago

aiight, let's go with hapi for now

Pomax commented 9 years ago

We should also always tag our webservice APIs with versions, so that we have things like blah.webmaker.moo/api/v1.0/... rather than blah.webmaker.moo/api/... to allow for better sunsetting of outdated APIs. If we're developing an API that we're certain we're never going to change, we're basically just lying to ourselves =P

Pomax commented 9 years ago

After 2 days of evaluating Hapi+Joi, I can only conclude that they're seriously horrible to learn (the official tutorials and docs are terrible) and I don't want to subject anyone else in our team to that when Express does what we need, so I'm rewriting the chapter to reflect that. Maybe once Hapi and Joi have better docs, intake, and APIs (the Joi API is truly dire) we can reassess them. For now, I'm calling veto on them.

k88hudson commented 9 years ago

I also feel like we should consider exploring Hapi – see

http://hueniverse.com/2012/12/20/hapi-a-prologue/

and

http://matt-harrison.com/moving-from-express-to-hapi-js/

Where I think Hapi gets really interesting is testing. See https://medium.com/the-spumko-suite/testing-hapi-services-with-lab-96ac463c490a

k88hudson commented 9 years ago

I think testing is one of our weakest areas as a team – we need structure. If we do choose to stick with express, we need to adjust/define the way we build express modules/routes/etc. so they are testable since express is non-opinionated about it

k88hudson commented 9 years ago

don't mean to derail but I feel like it has to be said

Pomax commented 9 years ago

@k88hudson see my comment about why I'm putting us back on Express. If we need better test coverage/policy, then let's do that, and make sure we keep at it by being prudent during review. (e.g. No test -> "r-, this code needs test coverage")

I will be happy to reevaluate if you know of an excellent "learning Hapi" resource, but Hapi itself does not offer anything even remotely close to decent as part of the official docs and tutorials.

thisandagain commented 9 years ago

@Pomax Seems odd to veto joi but not specify an alternative for object validation... JSON schema? I agree with you re: smaller community and poor docs, but I'd like to see a plan for how we do route testing in Express and server-side input validation.

davidascher commented 9 years ago

Suggest we split up this issue into a few: server-side routing framework, testing framework, storage (although my own take is that's a tough one to answer w/o knowledge of the specifics), object validation, etc.

gvn commented 9 years ago

FWIW this was originally intended to be our front end stack chapter, so yeah I agree splitting it up might be prudent. :+1:

Pomax commented 9 years ago

+1 on splitting this up, this chapter's been scope creeping.