<!DOCTYPE html>
<html lang="en">

  <head>
    <title>Angular Frontend page</title>
    <script data-require="angularjs@1.6.4" data-semver="1.6.4" src="https://code.angularjs.org/1.6.4/angular.min.js"></script>
    <script src="myapp.js"></script>
    <script src="myController.js"></script>
  </head>

  <body>
    <h1>This page is being served by Hapi and Inert</h1>
    <div ng-app="myApp" ng-controller="myCtrl">
      <label>
        {{hello}} {{world}}
    </label>
    </div>
  </body>

</html>
const myapp = angular.module('myApp', [])
myapp.controller('myCtrl', function ($scope) {
  $scope.hello = 'HELLO'
  $scope.world = 'WORLD'
})
const Hapi = require('hapi')
const Inert = require('inert')
const Path = require('path')

const server = Hapi.server({
  host: 'localhost',
  port: 3000,
  routes: {
    files: {
      relativeTo: Path.join(__dirname, 'public')
    }
  }
})

async function start () {
  await server.register(Inert)
  server.route({
    method: 'GET',
    path: '/{path*}',
    handler: {
      file: 'index.html'
    }
  })
  await server.start()
  console.log(`Server running at: ${server.info.uri}`)
}

start()