Matias Alejo Garcia
11 years ago
4 changed files with 51 additions and 15 deletions
@ -0,0 +1,33 @@ |
|||
'use strict'; |
|||
|
|||
|
|||
var Block = require('../models/Block'); |
|||
//, _ = require('lodash');
|
|||
|
|||
|
|||
|
|||
/** |
|||
* Module dependencies. |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* Find block by hash ... |
|||
*/ |
|||
exports.block = function(req, res, next, hash) { |
|||
Block.fromHash(hash, function(err, block) { |
|||
if (err) return next(err); |
|||
if (!block) return next(new Error('Failed to load block ' + hash)); |
|||
req.block = block; |
|||
next(); |
|||
}); |
|||
}; |
|||
|
|||
|
|||
/** |
|||
* Show block |
|||
*/ |
|||
exports.show = function(req, res) { |
|||
res.jsonp(req.block); |
|||
}; |
|||
|
Loading…
Reference in new issue