Hapi: Setting up server to serve Angular2 application

Created on 22 May 2016  路  6Comments  路  Source: hapijs/hapi

Hi, I would just like some help setting up angular2 to run from a public folder under hapijs. Atm i have read several other issues about this, but none seem to resolve my problem.

any help would be greatly appreciated.

support

Most helpful comment

I looked, I see nothing for Angular2

All 6 comments

What is it that you want to do exactly and what problem(s) are you facing?
Also general hapi question should go https://github.com/hapijs/discuss (the hapijs/hapi issues are for hapi bugs etc)

well i am trying to use this:

server.ext('onPreResponse', function (request, reply) {

    var response = request.response;

    console.log(request.url);

    if (!response.isBoom ||
        response.output.statusCode !== 404) {

        return reply();
    }

    reply.file('./public/index.html');

});

to route 404's back to index.html but just get system js can not be found in the angular app, well returns index.html instead of the system.js file.

Look at the boilerplates: http://hapijs.com/resources#Boilerplates. There are examples for React, Angular, etc.

I looked, I see nothing for Angular2

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

Was this page helpful?
0 / 5 - 0 ratings