Created
July 10, 2020 03:29
-
-
Save peekpi/9d8e0a6d0281439dccbe390e5d81f744 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/app.ts | |
// import "./dashboard"; | |
//import "./explorer"; | |
import express from "express"; | |
import http from "http"; | |
import "source-map-support/register"; | |
const app = express(); | |
const server = http.createServer(app); | |
import HttpStatus from "http-status-codes"; | |
import cors from "cors"; | |
app.use(cors()); | |
// hrc20 demo service | |
const hrc20service = require('./explorer/hrc20/hrc20-syncer.js'); | |
app.get("/hrc20-txs", async (req, res) => { | |
const id = req.query.id; | |
const txs = hrc20service.queryHrc20TxsByAddress(id); | |
if (txs) { | |
res.send( {txs} ); | |
} else { | |
res.status(HttpStatus.BAD_REQUEST).send({ | |
message: "failed", | |
err: "Not Found" | |
}); | |
} | |
}); | |
app.listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment