Explorer page with latest blocks. WIP

This commit is contained in:
Simon Lindh
2019-11-06 15:35:02 +08:00
parent 7344c518d3
commit 02d67e8406
22 changed files with 225 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
import statistics from './api/statistics';
import feeApi from './api/fee-api';
import projectedBlocks from './api/projected-blocks';
import bitcoinApi from './api/bitcoin/bitcoin-api-factory';
class Routes {
private cache = {};
@@ -75,6 +76,20 @@ class Routes {
res.status(500).send(e.message);
}
}
public async getBlocks(req, res) {
try {
let result: string;
if (req.params.height) {
result = await bitcoinApi.getBlocksFromHeight(req.params.height);
} else {
result = await bitcoinApi.getBlocks();
}
res.send(result);
} catch (e) {
res.status(500).send(e.message);
}
}
}
export default new Routes();