eth.link api

This commit is contained in:
Karol Wypchlo 2021-10-01 15:49:46 +02:00
parent a59152bb56
commit 066c7e2d1f
No known key found for this signature in database
GPG Key ID: C92C016317A964D0
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import fs from "fs";
import got from "got"; import got from "got";
import { extension as toExtension } from "mime-types"; import { extension as toExtension } from "mime-types";
import { Collection } from "mongodb"; import { Collection } from "mongodb";
import { convertSkylinkToBase64 } from "skynet-js";
import { API_HOSTNAME, API_PORT, MONGO_CONNECTIONSTRING, MONGO_DBNAME, UPLOAD_PATH } from "./consts"; import { API_HOSTNAME, API_PORT, MONGO_CONNECTIONSTRING, MONGO_DBNAME, UPLOAD_PATH } from "./consts";
import { MongoDB } from "./mongodb"; import { MongoDB } from "./mongodb";
import { IRecord } from "./types"; import { IRecord } from "./types";
@ -36,6 +37,8 @@ require("dotenv").config();
app.get("/ipfs/eth/dns-query/:name", async (req: Request, res: Response) => { app.get("/ipfs/eth/dns-query/:name", async (req: Request, res: Response) => {
try { try {
console.log(`https://eth.link/dns-query?type=TXT&name=${req.params.name}`);
const response = await got(`https://eth.link/dns-query?type=TXT&name=${req.params.name}`, { const response = await got(`https://eth.link/dns-query?type=TXT&name=${req.params.name}`, {
headers: { "content-type": "application/dns-json" }, headers: { "content-type": "application/dns-json" },
}).json(); }).json();