I'm trying to build a simple bidirectional DNode app using the DNode tutorial here. However I'm not sure how to serve the client-side dnode js.
The example includes the following code:
var js = require('dnode/web').source();
var httpServer = http.createServer(function (req,res) {
if (req.url == '/dnode.js') {
res.writeHead(200, { 'Content-Type' : 'text/javascript' });
res.end(js);
}
//...
But the app won't run. I get: "Error: Cannot find module 'dnode/web'"
DNode is installed via npm. Any ideas?
dnode/web is the really ancient way of hosting the source. Now /dnode.js is available by default so you can just <script src="/dnode.js"></script>
.