Simple image host.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

api.js 441B

12345678910111213141516171819202122232425
  1. module.exports = function(req, res, templates, conf) {
  2. this.req = req;
  3. this.res = res;
  4. this.templates = templates;
  5. this.conf = conf;
  6. }
  7. module.exports.prototype = {
  8. end: function(str) {
  9. this.res.end(str);
  10. },
  11. template: function(name, args) {
  12. var str = this.templates[name];
  13. if (!str)
  14. throw new Error("No such template: "+name);
  15. for (var i in args) {
  16. str = str.split("{{"+i+"}}").join(args[i]);
  17. }
  18. return str;
  19. }
  20. }