Skip to content Skip to sidebar Skip to footer

Setstatic Function In Httpdispatcher

i am building a server in node.js but am unable to understant the function of setStatic in httpdispatcher in the this example that i got on the net.. var http = require

Solution 1:

add following line

dispatcher.setStaticDirname(__dirname);

before

dispatcher.setStatic('resources');

and try with http://localhost:8080/resources/dwnl.png

Solution 2:

Please see Node.js cannot find basic functions This answer explains that httpdispatcher must be instantiated before use using something like:

var httpdispatcher = require('httpdispatcher');

var dispatcher = newhttpdispatcher();

otherwise you will get runtime TypeErrors because dispatcher does not exist.

Post a Comment for "Setstatic Function In Httpdispatcher"