Tag: nodejs

Using Handlebars with Hapi

This tutorial is compatible with hapi v17. Node and Hapi should be installed for work with this tutorial. In Hapi we can use different template engines to achieve dynamic HTML with dynamic data. One of this engines – Handlebars. In this tutorial we will learn how to use handlebars with Hapi framework.  Setup the server

How to send files using Hapi

This tutorial is compatible with Hapi v17.8.1 The Inert plugin provides a wide range of functionality to work with files in routes in Hapi. First of all you need to install the Inert module to your app using NPM or Yarn and register it before your server will start.You can install it in terminal using the next commands:

How to make redirect in Hapi

This tutorial is compatible with Hapi v17.8.1To create a simple redirect we can use the .redirect() method in the handler of route. This method takes a relative or an absolute URI used to redirect the client to the passed resource. It sets the 302 HTTP redirection: Also, the second way to set the 302 redirect: The