Skip to content

Commit

Permalink
Added /
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino committed Nov 21, 2022
1 parent 352d635 commit dc5e395
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function makeRpc(isTestnet, name, ...params){
params,
}),
});

const obj = await output.json();
if(obj.error) {
const imATeapot = 418;
Expand All @@ -49,6 +50,7 @@ async function makeRpc(isTestnet, name, ...params){
if (error.errno === "ECONNREFUSED") {
return { status: 503, response: "PIVX node was not responsive."};
}
console.error(error);
if (error.name === 'AbortError') {
return "brequbest was aborted'";
}else{
Expand All @@ -64,7 +66,7 @@ function parseParams(params) {
.map(v=>v === "false" ? false : v);
}

app.get('mainnet/:rpc', async function(req, res) {
app.get('/mainnet/:rpc', async function(req, res) {
try {
if (allowedRpcs.includes(req.params["rpc"])) {

Expand All @@ -76,12 +78,13 @@ app.get('mainnet/:rpc', async function(req, res) {
res.status(forbiddenStatus).send("Invalid RPC");
}
} catch (e) {
console.error(e);
const internalError = 500;
res.status(internalError).send("Internal server error");
}
});
if(testnetRpcPort) {
app.get('testnet/:rpc', async function(req, res) {
app.get('/testnet/:rpc', async function(req, res) {
try {
if (allowedRpcs.includes(req.params["rpc"])) {

Expand Down

0 comments on commit dc5e395

Please sign in to comment.