ccarruitero / makemehapi

Self guided workshops to teach you about hapi.
https://www.npmjs.com/package/makemehapi
Other
480 stars 107 forks source link

issue #196 Upgrade for hapi v17? #198

Closed lancelot316 closed 6 years ago

lancelot316 commented 6 years ago

I updated as best I could the problem and solution files to hapi v17. I was unable to update the upload tutorial, because I couldn't figure out how to make it work without the reply callback.

I have seen a several different ways to configure the server and call server.start. I used an async IIFE instead of a named function and a separate call to that function, because it seemed a little cleaner to me.

fiveisprime commented 6 years ago

The proxies exercise needs updated here: https://github.com/lancelot316/makemehapi/blob/master/exercises/proxies/exercise.js#L36-L48

lancelot316 commented 6 years ago

I made the changes you mentioned. I think I got everything, except the uploads exercise I'm still learning the framework, but I figured as I was learning Hapi I could try and contribute back what I have learned so far.

fiveisprime commented 6 years ago

Thanks again! There's one more change needed in the proxies exercise to return the response rather than use the old reply method.

Also, this is what I came up with for the uploads solution, you're welcome to build on/use this: https://gist.github.com/fiveisprime/99605395e87f6b3d9af87f49316fe43b

I'm not 100% on if that's optimal; I had to return a promise to allow for the stream processing. There may be a better way to handle that and there isn't any error handling for the rejection.