diff --git a/src/app.js b/src/app.js index 54661d7..5e4dc52 100644 --- a/src/app.js +++ b/src/app.js @@ -31,6 +31,7 @@ const utilV3 = require("./routes/v3/util") const slpV3 = require("./routes/v3/slp") const xpubV3 = require("./routes/v3/xpub") const blockbookV3 = require("./routes/v3/blockbook") +const Ninsight = require("./routes/v3/ninsight") require("dotenv").config() @@ -93,6 +94,9 @@ app.use(`/${v3prefix}/` + `slp`, slpV3.router) app.use(`/${v3prefix}/` + `xpub`, xpubV3.router) app.use(`/${v3prefix}/` + `blockbook`, blockbookV3.router) +const ninsight = new Ninsight() +app.use(`/${v3prefix}/` + `ninsight`, ninsight.router) + // catch 404 and forward to error handler app.use((req, res, next) => { const err = { diff --git a/src/routes/v3/ninsight.js b/src/routes/v3/ninsight.js new file mode 100644 index 0000000..97ee56c --- /dev/null +++ b/src/routes/v3/ninsight.js @@ -0,0 +1,32 @@ +/* + A library for interacting with the Bitcoin.com ninsight (not Insight) indexer. +*/ + +"use strict" + +const express = require("express") +const axios = require("axios") +const routeUtils = require("./route-utils") +const wlogger = require("../../util/winston-logging") + +const router = express.Router() + +const BCHJS = require("@chris.troutner/bch-js") +const bchjs = new BCHJS() + +let _this + +class Ninsight { + constructor() { + _this = this + + this.router = router + this.router.get("/", this.root) + } + + root(req, res, next) { + return res.json({ status: "ninsight" }) + } +} + +module.exports = Ninsight