Node js file problems

Node js file problems
0

#1

Hey everyone, I’m having trouble getting my jquery file to work on an html file in the voting app project, here’s a link to my repo:

I’m trying to get polls.js to link to createchart.html but for some reason it doesn’t seem to be working. Can anyone see what I’m doing wrong?


#2

is your path() configuration correct?


#3

I thought so but I could be wrong?


#4
<script type = "text/jquery" .... wondering would this cause a problem try changing to <script type = "text/javascript"

#5

I’ve now tried changing it to text/javascript and putting all my javascript on the page inside the script tag but that doesn’t seem to work either…


#6

ok cloned your repository so i could look at it a bit better … starting to work on this project myself at the moment but taking it very slowly so i can understand things …
found a few things …
1} you have no actual route for the createchart.html … you have a route for / … logout … and chart
so i added a createchart route and was then able to access the page
2)… i couldnt access the polls.js so i checked and you still had text/jquery so changed it to text/javascript … i now have access to your polls.js
3) you have
var jsdom=require(‘jsdom’);
var $=require(‘jquery’)(jsdom.jsdom().createWindow());
on the top of the polls.js page … this causes errors as you cannot use require from the client side … googled the problem and that is what stack overflow says … http://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-require-is-not-defined
and as i dont know what these files do i cant say how not having access to them will affect your code

other than that i cant do anymore
could you explain this line to me … app.use(express.static(path.join(__dirname, ‘/node_modules’))) … i havent seen anything like this using node_modules before
anyway hope that helps.