From 2297f3b77c61fa495961e1c71873071587c1c0c5 Mon Sep 17 00:00:00 2001 From: Darwin <77340894+charmful0x@users.noreply.github.com> Date: Fri, 3 Mar 2023 17:35:21 +0100 Subject: [PATCH] feat: render molecule.sh homepage --- src/api.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/api.js b/src/api.js index 1a4e925..3edb45a 100644 --- a/src/api.js +++ b/src/api.js @@ -1,6 +1,9 @@ import express from "express"; import cors from "cors"; import assert from "node:assert"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import base64url from "base64url"; import { checkSubdomain } from "./utils/resolving.js"; import { getArTxObject } from "./molecules/ar/atoms/tx-gql.js"; @@ -27,17 +30,23 @@ import { readNearOracleState } from "./molecules/near/atoms/read-contract.js"; import { getEverTxObject } from "./molecules/everpay/atoms/tx.js"; import { getTokenPrice } from "./molecules/redstone/atoms/oracle.js"; import { postExmData } from "./molecules/exm/atoms/bundlr.js"; -import base64url from "base64url"; const app = express(); const port = process.env.PORT || 3000; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + app.use( cors({ origin: "*", }) ); +app.get("/", (req, res) => { + res.sendFile(path.join(__dirname + "/views/homepage.html")); +}); + app.get("/tx-gql/:txid", async (req, res) => { try { res.setHeader("Content-Type", "application/json");