Skip to content

Instantly share code, notes, and snippets.

@peekpi
Created July 10, 2020 03:29
Show Gist options
  • Save peekpi/9d8e0a6d0281439dccbe390e5d81f744 to your computer and use it in GitHub Desktop.
Save peekpi/9d8e0a6d0281439dccbe390e5d81f744 to your computer and use it in GitHub Desktop.
// 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