hapi icon indicating copy to clipboard operation
hapi copied to clipboard

Setting up server to serve Angular2 application

Open matthewhardern opened this issue 10 years ago • 6 comments

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.

matthewhardern avatar May 22 '16 10:05 matthewhardern

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)

AdriVanHoudt avatar May 22 '16 10:05 AdriVanHoudt

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.

matthewhardern avatar May 22 '16 12:05 matthewhardern

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

gergoerdosi avatar May 22 '16 12:05 gergoerdosi

I looked, I see nothing for Angular2

blex2011 avatar Jul 21 '16 14:07 blex2011

I think this was added later on.

https://github.com/ptpaterson/hapi-angular-quickstart

MaheshSasidharan avatar Nov 04 '17 20:11 MaheshSasidharan

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.

lock[bot] avatar Jan 09 '20 16:01 lock[bot]