Skip to content

Instantly share code, notes, and snippets.

@monolithed
Created May 1, 2012 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monolithed/2566882 to your computer and use it in GitHub Desktop.
Save monolithed/2566882 to your computer and use it in GitHub Desktop.
TSN example
var TSN = require('TSN');
var fs = require("fs");
var template = TSN.load('template.xml');
var file = fs.createWriteStream('template.html', {
flags: 'a',
encoding: 'utf-8',
mode: 0666
});
var result = TSN.render(template, file);
file.on('error', function(error) {
console.error(error);
});
file.write(result);
file.end(function() {
console.log('Ok!');
});
@monolithed
Copy link
Author

var TSN = require('TSN');
var template = TSN.load('page.xml');

http.Server(function (request, response) {
     template.call({ data: 'value' }, response);
};).listen(port, ip);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment