<commit_before>import 'zone.js/dist/zone-node';

import { ngHapiEngine } from '@nguniversal/hapi-engine';
import * as inert from '@hapi/inert';
import { Request, Server, ResponseToolkit } from '@hapi/hapi';
import { join } from 'path';
import { readFileSync, existsSync } from 'fs';

import { AppServerModule } from './src/<%= stripTsExtension(main) %>';

// The Hapi server is exported so that it can be used by serverless functions.
export async function app(): Promise<void> {
  const port = process.env.PORT || <%= serverPort %>;
  const distFolder = join(process.cwd(), '<%= browserDistDirectory %>');
  const server = new Server({
    port,
    routes: {
      files: {
        relativeTo: distFolder
      }
    },
  });

  const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index.html';
  const document = readFileSync(join(distFolder, indexHtml), 'utf-8');

  server.route({
    method: 'GET',
    path: '/{path*}',
    handler: (req: Request) => ngHapiEngine({
      bootstrap: AppServerModule,
      document,
      req,
    })<commit_msg>fix(hapi-engine): ng-add schematic<commit_after>import 'zone.js/dist/zone-node';

import { ngHapiEngine } from '@nguniversal/hapi-engine';
import * as inert from '@hapi/inert';
import { Request, Server, ResponseToolkit } from '@hapi/hapi';
import { join } from 'path';
import { readFileSync, existsSync } from 'fs';

import { AppServerModule } from './src/<%= stripTsExtension(main) %>';

// The Hapi server is exported so that it can be used by serverless functions.
export async function app(): Promise<Server> {
  const port = process.env.PORT || <%= serverPort %>;
  const distFolder = join(process.cwd(), '<%= browserDistDirectory %>');
  const server = new Server({
    port,
    routes: {
      files: {
        relativeTo: distFolder
      }
    },
  });

  const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index.html';
  const document = readFileSync(join(distFolder, indexHtml), 'utf-8');

  server.route({
    method: 'GET',
    path: '/{path*}',
    handler: (req: Request) => ngHapiEngine({
      bootstrap: AppServerModule,
      document,
      req,
    })
{'fraction_non_alphanumeric': 0.1548532731376975, 'fraction_numerical': 0.0009029345372460496, 'mean_word_length': 3.7048832271762207, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1093033', 'n_tokens_mistral': 704, 'n_tokens_neox': 680, 'n_words': 184}