O'Reilly logo

hapi.js in Action by Matt Harrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Building an API

This chapter covers

  • Building an API with hapi.js
  • Integrating business logic
  • Working with databases

You saw in chapter 1 that hapi apps are constructed by working with servers, routes, handlers, plugins, and your own business logic. In this chapter, you’ll see how those pieces come together. First I introduce a fictional brief for an API project that I’m going to build. Next I figure out the technical requirements and plan the API endpoints. Then I move on to implementing this in hapi step-by-step.

I won’t be diving too deeply into any single component of hapi yet. Instead, I’m going to take a more high-level approach, giving you the bigger picture of how apps in hapi are built.

2.1. Designing the API

This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required