I'm rather new to how webservers behave in general, so I have a few questions I hope someone can help me with. It would also be nice if anyone could point me to an article or some documentation about the following topics.Basically I'm trying to develop a webapp using Angular2, Expressjs and obviously node.js. I have already successfully developed some basic Angular2 apps without a backend attached to it, which worked fine. However, now I'm trying to send the index.html file (which contains a tag referring to an Angular component) to the browser from my server.app.get('/test', function(req, res) { res.sendfile('index.html'); }); You can find the html here: http://ift.tt/1S3eewV, even though the node_modules package is on the same hierarchic level as both server.js and index.html, going to localhost:8080/test gives me a 404 for the node_modules script files in my html header.Q1: Why doesn't my server find the node_modules folder?Now, when I run my index.html file through following link, http://localhost:54720/testapp/index.html, everything works just fine. Somehow it finds the node_modules at port 54720 but not 8080 (which is the port I made the express app listen on).Q2: Why can't my server find the node_modules folder at the port I make it listen on?As I've already said, I'm really new to node.js and webservers in general. I'd be very grateful for any help! Even linking me to an article which could be helpful would help me tons, since I can't really find anything since I don't know what to Google for.
Submitted February 04, 2016 at 05:57PM by Kattoor
No comments:
Post a Comment