diff --git a/app/controllers/transactions.js b/app/controllers/transactions.js index 41be1c4..61c4159 100644 --- a/app/controllers/transactions.js +++ b/app/controllers/transactions.js @@ -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; diff --git a/config/routes.js b/config/routes.js index d7d57d8..77b3315 100644 --- a/config/routes.js +++ b/config/routes.js @@ -4,14 +4,15 @@ module.exports = function(app, historicSync) { //Home route var index = require('../app/controllers/index'); - + 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); - + app.get('/api/version', index.version); //Block routes @@ -41,5 +42,5 @@ module.exports = function(app, historicSync) { app.get('/api/status', st.show); app.get('/api/sync', st.sync); - + }; diff --git a/public/js/config.js b/public/js/config.js index eaddc38..5fe4e68 100755 --- a/public/js/config.js +++ b/public/js/config.js @@ -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' diff --git a/public/views/redirect.html b/public/views/redirect.html new file mode 100644 index 0000000..bccac72 --- /dev/null +++ b/public/views/redirect.html @@ -0,0 +1 @@ +
Redirecting...