outmoded / university

Community learning experiment
Other
371 stars 193 forks source link

My assignment1 #264

Closed LiangRenDev closed 5 years ago

LiangRenDev commented 6 years ago

Handler changed in hapi version 17.5.2

Since the right answer still use old version 16's method to create server and reply, need a new version to refelect changes on hapi 17.5.2

zoe-1 commented 6 years ago

See sample solution for more details. In respect to how the hapi server is built and started, we need to build the server as a function which can be exported. Therefore, using the IIFE function call does not work. Future assignments will export the 'init' or 'start' function to a start script and test scripts. Plus, if we plan to build multiple hapi services which communicate with each other, it is important to build the hapi servers / services in a way that another application can start and stop them (ie. manage the services). Exporting the init() allows for this. This assignment does not require an init() to be exported. Just trying to explain some of the reasons for hapi's style preferences and why we don't use IIFE functions to start the server. Above Module Global Styles shows preferred style to init() the server.

LiangRenDev commented 6 years ago

Hi, Zoe Thanks for your good explanation, I have another project to run so it takes me so long to code according to the convention. I add ESLint and apply convention rules using it.