flosight-api/app/controllers/blocks.js
2014-01-07 09:48:31 -03:00

34 lines
485 B
JavaScript

'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);
};