Merge pull request #157 from cmgustavo/feature/01bug-route-index

block without info on list of tx (eg. genesis block). url: block-index n...
This commit is contained in:
Mario Colque 2014-01-24 13:02:04 -08:00
commit a40b87c4b6
4 changed files with 12 additions and 7 deletions

View File

@ -71,10 +71,13 @@ exports.list = function(req, res, next) {
if (bId) {
Block.fromHashWithInfo(bId, function(err, block) {
if (err && !block) {
if (err) {
console.log(err);
res.status(404).send('Not found');
return next();
return res.status(500).send('Internal Server Error');
}
if (! block) {
return res.status(404).send('Not found');
}
txLength = block.info.tx.length;

View File

@ -8,6 +8,7 @@ module.exports = function(app, historicSync) {
app.get('/', index.render);
app.get('/blocks', index.render);
app.get('/blocks-date/*', index.render);
app.get('/block-index/*', index.render);
app.get('/block/*', index.render);
app.get('/tx/*', index.render);
app.get('/address/*', index.render);

View File

@ -9,7 +9,7 @@ angular.module('insight').config(['$routeProvider',
}).
when('/block-index/:blockHeight', {
controller: 'BlocksController',
template: 'Redirecting...'
templateUrl: '/views/redirect.html'
}).
when('/tx/:txId', {
templateUrl: '/views/transaction.html'

View File

@ -0,0 +1 @@
<div class="text-center">Redirecting...</div>