mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(api docs): Added api docs and first docs
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@
|
||||
"test:integration": "mocha test/v3/integration",
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"coverage:report": "export NETWORK=testnet && nyc --reporter=html mocha test/v2/",
|
||||
"docs": "./node_modules/.bin/apidoc -i src/ -o docs"
|
||||
"docs": "./node_modules/.bin/apidoc -i src/routes/v3 -o docs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.15.1"
|
||||
|
||||
+3
-1
@@ -76,7 +76,9 @@ app.enable("trust proxy")
|
||||
app.set("views", path.join(__dirname, "views"))
|
||||
app.set("view engine", "jade")
|
||||
|
||||
app.use("/public", express.static(`${__dirname}/public`))
|
||||
// Mount the docs
|
||||
app.use("/docs", express.static(`${__dirname}/../docs`))
|
||||
|
||||
app.use(logger("dev"))
|
||||
app.use(bodyParser.json())
|
||||
app.use(bodyParser.urlencoded({ extended: false }))
|
||||
|
||||
+14
-7
@@ -4,9 +4,9 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>The HTML5 Herald</title>
|
||||
<meta name="description" content="The HTML5 Herald">
|
||||
<meta name="author" content="SitePoint">
|
||||
<title>BCH API</title>
|
||||
<meta name="description" content="BCH API">
|
||||
<meta name="author" content="Chris Troutner">
|
||||
|
||||
<link rel="stylesheet" href="css/styles.css?v=1.0">
|
||||
|
||||
@@ -18,10 +18,17 @@
|
||||
This web server is based on <a href="https://rest.bitcoin.com">rest.bitcoin.com</a>.
|
||||
Go there to view an interactive UI of the REST API endpoints.
|
||||
</p>
|
||||
<p>
|
||||
View the API documentation
|
||||
on <a href="https://developer.bitcoin.com/rest/docs/getting-started">developer.bitcoin.com</a>.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/docs">
|
||||
View the BCH-API documentation
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
View the original rest.bitcoin.com API documentation
|
||||
on <a href="https://developer.bitcoin.com/rest/docs/getting-started">developer.bitcoin.com</a>.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<script src="js/scripts.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -61,6 +61,16 @@ async function balanceFromBitcore(thisAddress) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /bitcore/balance/:address Get BCH balance for an address
|
||||
* @apiName GetBalance
|
||||
* @apiGroup Bitcore
|
||||
*
|
||||
* @apiParam {String} address Bitcoin Cash address.
|
||||
*
|
||||
* @apiSuccess {String} firstname Firstname of the User.
|
||||
* @apiSuccess {String} lastname Lastname of the User.
|
||||
*/
|
||||
// GET handler for single balance
|
||||
async function balanceSingle(req, res, next) {
|
||||
try {
|
||||
|
||||
@@ -13,13 +13,34 @@ const util = require("util")
|
||||
util.inspect.defaultOptions = { depth: 1 }
|
||||
|
||||
router.get("/", root)
|
||||
router.get("/getInfo", getInfo)
|
||||
router.get("/getinfo", getInfo)
|
||||
|
||||
function root(req, res, next) {
|
||||
return res.json({ status: "control" })
|
||||
}
|
||||
|
||||
// Execute the RPC getinfo call.
|
||||
/**
|
||||
* @api {get} /control/getinfo Get full node info
|
||||
* @apiName GetInfo
|
||||
* @apiGroup Control
|
||||
* @apiDescription RPC call which gets basic full node information.
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "http://localhost:5000/v3/control/getinfo" -H "accept: application/json"
|
||||
*
|
||||
* @apiSuccess {Object} object Object containing data
|
||||
* @apiSuccess {Number} object.version Full node version
|
||||
* @apiSuccess {Number} object.protocolversion Protocol version
|
||||
* @apiSuccess {Number} object.blocks Current block
|
||||
* @apiSuccess {Number} object.timeoffset ?
|
||||
* @apiSuccess {Number} object.connections Number of connected peers
|
||||
* @apiSuccess {String} object.proxy ?
|
||||
* @apiSuccess {Number} object.difficulty Current difficulty setting
|
||||
* @apiSuccess {Boolean} object.testnet testnet = true, mainnet = false
|
||||
* @apiSuccess {Number} object.paytxfee ?
|
||||
* @apiSuccess {Number} object.relayfee ?
|
||||
* @apiSuccess {String} object.errors ?
|
||||
*/
|
||||
async function getInfo(req, res, next) {
|
||||
const {
|
||||
BitboxHTTP,
|
||||
|
||||
Reference in New Issue
Block a user