outmoded / discuss

The "mailing list"
99 stars 9 forks source link

hapi-angular-quickstart #479

Closed Zewenaco closed 5 years ago

Zewenaco commented 7 years ago

Hi, my name is Anderson, i am trying to integrate hapijs with angular 2. I just start this week with nodejs and i decided start with hapijs. I create a my server and everything goes well, some few services, a little interfaces consuming the services, and it's ok.

Then, the big step to integrate it with angular 2 because i want to build a webpage with this components, and i download your boilerplate of hapi-angular-quickstart https://github.com/ptpaterson/hapi-angular-quickstart, but i cannot make it work, i get the message between the tag Loading AppComponent content here ... and the angular app don't start.

Can i have some help with this? i really want work with hapijs

Zewenaco commented 7 years ago

This is the trace of the server :

Server is listening on http://localhost:3000 170421/181709.663, [response] http://localhost:3000: get /quickstart {} 200 (88ms) 170421/181709.766, [response] http://localhost:3000: get /styles.css {} 404 (21ms) 170421/181709.778, [response] http://localhost:3000: get /node_modules/core-js/client/shim.min.js {} 404 (12ms) 170421/181709.782, [response] http://localhost:3000: get /node_modules/zone.js/dist/zone.js {} 404 (9ms) 170421/181709.793, [response] http://localhost:3000: get /node_modules/systemjs/dist/system.src.js {} 404 (49ms) 170421/181709.838, [response] http://localhost:3000: get /systemjs.config.js {} 404 (6ms) 170421/181709.846, [log,connection,client,error] message: write ECANCELED, stack: Error: write ECANCELED at exports._errnoException (util.js:1022:11) at WriteWrap.afterWrite (net.js:801:14)

AdriVanHoudt commented 7 years ago

Did you alter the quickstart because it only exposes certain routes https://github.com/ptpaterson/hapi-angular-quickstart/blob/master/angular-quickstart/index.js#L17-L24

Zewenaco commented 7 years ago

Nop, i didn't change anything i just download it and execute "npm install" and later "node server.js" and i just get the error. there is something i can do for fix it?,

AdriVanHoudt commented 7 years ago

You need to adapt the quickstart to allow it to serve your files

Zewenaco commented 7 years ago

Right, but i don't know how do that, i guess is that something like this image.

23-04-2017 12-07-07

WesTyler commented 7 years ago

If this is your first time working in hapi I would suggest starting with a basic "Hello World" server just to get acquainted with how hapi routes are defined and registered. Build up from a GET sending some text back until you are serving some basic files; then go back and look at the Angular quick start to see how it is accomplishing everything.

In my experience at least, jumping straight into a scaffold/generator for a new tech is the easiest way to get lost. They tend to have "clever" ways of making things extensible and flexible, but not very readable and understandable to newcomers.

zoe-1 commented 7 years ago

@Zewenaco checkout https://github.com/hapijs/university This will get you started with hapi. It does not use angular but does show how to include JavaScript scripts in a project. You can apply the Javascript loading logic to loading angularjs.