For hapi beginners: step by step from zero to deployment
In this ready-made beginner path you’re going to learn hapi step by step. Create a project with multiple routes, view rendering support, serving CSS, JS files and images. Further, add authentication and restrict access with scopes. Finally, deploy and run your app in production. Ready to make it rock? BOOM! 💥
Get started with hapi and kick off your first server. Send a request from your browser and see your new hapi server in action!
This guide walks you through the essentials of routing and how to add routes for all kinds of HTTP methods (GET, POST, PUT, etc.)
hapi ships with minimum core and let’s you easily extend it with plugins. You’ll learn how to add functionality like view rendering with ease 🤘
It’s a best practice to separate application logic into plugins. Apply this pattern to your hapi app and make use of individual plugins that add your desired behavior.
Register the vision
to your hapi server and add view rendering support for various templating engines.
Using the inert
plugin allows you to easily server static files, like CSS, JS, and images.
Authenticating users by username and passwords is common. Remembering them as well. Make the stay on your site as comfortably as possible by remembering them.
Skip the implementation of your own sign up and login flow. Use platforms like GitHub and let users authenticate with their GitHub account for your site.
Scopes are part of the authentication flow and allow simple access restrictions in your application. Like, only allow book buyers access to the club lounge with tasty coffee.
This is a common bug every hapi developer runs into. Of course, there’s a solution to fix it :)
User’s will send data to your server and you need to know how to access it.
Pick up query parameters if you want to transfer information from client to server within the URL.
The URL can consist of multiple elements divided by a given character, mostly the forward slash “/”. Make use of path parameters and benefit from complex setups with multiple or wildcard ones.
Put validation in place, no question about it.
If you use query parameters, put validation in place. No question about it.
Using path parameter values to fetch data from the database? Put validation in place. Not question about it.
Your site will be always on! With zero downtime deployments, you can deploy as often as possible, without interrupting the service.
The tools, frameworks & basics you need
It’s a beginner path, to get a grasp on hapi. Starters go from zero to production very quickly with an app that follows the recommendations of using hapi’s powerful plugin system.
Also, you’ll have an app with view support and delivering assets, like CSS, JS, and images to the client. Of course, you can deploy your app with zero downtime.
No expiration date. No plans to retire it. At some point, we might update or extend it though :)
No! It’s completely free. Free for everyone. Free willy 🐋