Skip to content

Instantly share code, notes, and snippets.

@Marak
Last active August 29, 2015 14:21
Show Gist options
  • Save Marak/740ba2945eef62734885 to your computer and use it in GitHub Desktop.
Save Marak/740ba2945eef62734885 to your computer and use it in GitHub Desktop.
hook.io microservice for using the view module
module['exports'] = function view (hook) {
var view = require('view');
var marak = 'https://raw.githubusercontent.com/Marak/marak.com/master/view';
var url = hook.req.headers['x-forwarded-url'];
view.create( { remote: marak } , function (err, v) {
if (err) {
return hook.res.end(err.message);
}
v.remote(url, function (err, result) {
if (err) {
return hook.res.end(err.message);
}
return hook.res.end(result);
});
});
};
module['exports'].cache = 60000000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment