how to run nodejs flatiron/director example
I tried to run the https://github.com/flatiron/director#client-side example to get familiar with director.js.
I am not able to setup the flatiron module on the client-side.
In my html page (say,
) I replaced the location of
a location of its counterpart from my project:
Upon loading the
page in the browser
I got errors: export and Router not defined.
First idea: After all, on the browser side there is no Nodejs...
Ok, I thought that browserify could help me with it. I generated a single 'browser-side' bundle (was it necessary?):
my_project> node node_modules/browserify/bin/cli.js node_modules/flatiron/node_modules/director/lib director.js -o cs_director.js
and I used it in the line:
The problem is that the error
Uncaught ReferenceError: Router is not defined (anonymous function)
still appears so I guess the whole example will not work.
I am new to node/js and I am not sure if it makes sens what I have done in my case described above... Does anybody how to solve it?
Or generally, how to use 'isomorphic' stuff on a browser-side? The html examples on Github just refer to the same .js files as server-side examples ...
Can you recommend any tutorials, examples?
You can find a browser-specific build of
director here which has all of the server code stripped away.