File: modules/jade.js

Recommend this page to a friend!
  Classes of Thomas Björk   Node.js Background Jobs   modules/jade.js   Download  
File: modules/jade.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Node.js Background Jobs
Run background jobs using Node.js modules
Author: By
Last change: Added an AutoReloadModule function that automatically reloads a module when it changes.
Added the Unload functions to modules which loads modules of its own.
Date: 3 years ago
Size: 654 bytes
 

Contents

Class file image Download
exports.UExecute = function(parts) { return false; }; exports.TExecute = function(parts, client) { var e, html, jade, nodeJade, options, s; nodeJade = true; try { s = require.resolve("jade"); if (s.length === 0) { nodeJade = false; } } catch (_error) { e = _error; nodeJade = false; } if (nodeJade) { jade = require("jade"); options = {}; html = jade.render(parts[1], options); client.write(html); client.end(); } else { client.write("404: JADE not available"); client.end(); } }; exports.Unload = function() { var name = require.resolve('jade'); delete require.cache[name]; }