By John Brett
- With assistance from this ebook, you are going to increase your productiveness as a developer and that of your group by way of concentrating on enterprise good judgment using the constitution that Hapi.js provides
- You might be brought to a real-world challenge and we will show how one can use the instruments Hapi offers to unravel it
- This is the one e-book with a learn-by-example approach
This publication will introduce hapi.js and stroll you thru the production of your first operating program utilizing the out-of-the-box positive factors hapi.js offers. full of real-world difficulties and examples, this publication introduces a few of the simple strategies of hapi.js and Node.js and takes you thru the common trip you are going to face while constructing an software. beginning with more uncomplicated recommendations corresponding to routing requests, development APIs serving JSON, utilizing templates to construct web content and purposes, and connecting databases, we then stream directly to extra advanced difficulties akin to authentication, version validation, caching, and methods for structuring your codebase to scale gracefully. additionally, you will boost talents to make sure your application's reliability via checking out, code assurance, and logging.
By the tip of this ebook, you may be outfitted with the entire abilities you want to construct your first totally featured program. This ebook might be important while you are investigating Node.js frameworks or making plans on utilizing hapi.js on your subsequent project.
What you are going to learn
- Increase your productiveness via profiting from the out-of-the-box gains hapi.js provides
- Build safe API servers
- Create web content and functions utilizing your favourite templating language
- Leverage hapi.js plugins to raised constitution your codebase
- Simplify your protection workflows with the integrated authentication and authorization performance of hapi.js
- Ensure program reliability with checking out and code coverage
- Reduce code complexity utilizing reusable validation common sense with joi
- Gather perception into your program functionality through logging
- Start the adventure to development powerful production-ready applications
About the Author
Later in his profession, John moved to a turning out to be SAAS corporation known as D4H applied sciences. As a lead engineer there, he constructed instruments to help emergency reaction groups globally, all from a lighthouse in Dublin, eire. right here, John obtained extra publicity to Node.js, prime D4H's first enterprise into Node utilizing hapi.js, later becoming a member of the hapi.js center team
Table of Contents
- Introducing hapi.js
- Adding performance via Routing Requests
- Structuring Your Codebase with Plugins
- Adding assessments and the significance of a hundred% Code Coverage
- Securing functions with Authentication and Authorization
- The joi of Reusable Validation
- Making Your software creation Ready
Read or Download Getting Started with hapi.js PDF
Similar web development & design books
Written for builders already utilizing . web and acquainted with C#, this ebook introduces the XML criteria and the . web meeting that implements the expertise, explains whilst it really is applicable to exploit each one expertise, and offers examples that illustrate how you can use the assemblies. The final 3rd of the booklet is an API reference that describes every one namespace, its kinds, and their contributors.
Endnote Made effortless: Reference administration for theProfessional is meant for healthcare execs (Physicians, Nurses, Managers, and so on. ) and biomedical researchers engaged in writing medical manuscripts. It aids readers in gaining an knowing of the powerful use of data expertise in storing, coping with, retrieving, and mentioning references in clinical writings.
Winner 2012 Small company publication Award via Small enterprise Trends"If you personal an internet site, you are a writer. " Interruption advertising and marketing is a specific thing of the earlier. we will be able to not merely consult our viewers. We needs to sign up for the dialog that is already occurring. the area of promoting has been noticeably altering within the final couple of years to a brand new type of advertising.
How do you want to percentage your calendar, entry your electronic mail, or create and proportion files, all on-line out of your smartphone/mobile gadget, netbook, or machine? in case you spoke back sure, then you definitely should still understand that the easiest of some of these on-line functions and providers are being provided at no cost, from one of many Internet's largest names, Google.
Extra resources for Getting Started with hapi.js
What I hope is evident from the preceding example is that even though slightly more verbose, the hapi example is quite simple to follow and understand. All configuration is done when creating the server. Configuration is done when creating a route, which means well-defined handlers that can focus on just handling the request and not dealing with other parts of the transport layer. js, and either type or copy-and-paste the preceding code. js If all goes as planned, you should see the following screen: If you navigate to this URL, you should have Hello World returned to you.
I will go through the request object and reply interface in more detail in later sections within this chapter, but for now it's enough to know the following: • The request object contains all the data from the request, including the raw request along with the extra information provided in the earlier stages of the request life cycle. • The reply interface returns whatever is provided to the user, and it will figure out the return type based on the data provided, such as JSON or PLAINTEXT. Also, one of the most common errors I see beginners make when starting out with hapi is calling reply() twice in one handler.
I see this with notes on modules such as express-validator, which must be called after body-parser or else the payload won't be validated, and no error will be thrown. This is a logic issue, not one related to code, and as such, there will be no errors for problems like this, which makes debugging a huge pain. I mentioned building infrastructure instead of application logic in the previous chapter, and this is a classic example of that. [ 26 ] Chapter 2 With hapi, you don't have to worry about any of these things, because at all times you'll know where you are in the request life cycle.