How can I bootstrap Dojo 1.7 in Node.js?
I've looked at the dojo-node module (https://github.com/agebrock/dojo-node) and the author says that Dojo 1.7 wi开发者_运维百科ll support Node.js natively.
There is a configNode.js file in Dojo 1.7, but I'm not sure how to use it to have Dojo up and running.
http://download.dojotoolkit.org/release-1.7.0b1/dojo-release-1.7.0b1/dojo/_base/
Can somebody point me into the right direction? Perhaps show me a small example also?
Appreciate any help I can get.
Here's my solution, although it may look tricky since I can't search out any official examples, I have to read the source and work it out:
Assume dojo is under
/home/root/dojoroot/dojo/dojo.js
Create
/home/root/mynode/test.js
with content:dojoConfig = {packages:[{name: 'test', location: '../../mynode'}]}; require('../dojoroot/dojo/dojo');
Create
/home/root/mynode/main.js
with content:define(['dojo/date'], function(date){ console.log('Hi ' + date.getTimezoneName(new Date()) + ', welcome to NodeJS!'); });
$> node /home/root/mynode/test.js load=test
精彩评论