Skip to content

Commit

Permalink
fix: Json read
Browse files Browse the repository at this point in the history
  • Loading branch information
chef-huan committed Jan 9, 2025
1 parent c6f5b96 commit 801d97d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/v1/collections/tokens/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { VercelRequest, VercelResponse } from "@vercel/node";
import { getAddress, isAddress, Contract } from "ethers";
import { paramCase } from "param-case";
import axios from "axios";
import ercABI from "../../../../utils/abis/ERC721.json" assert { type: "json" };
import { readFileSync } from "fs";
import { Attribute, Collection, Token } from "../../../../utils/types/index.js";
import { getModel } from "../../../../utils/mongo.js";
import { CONTENT_DELIVERY_NETWORK_URI, getTokenURI, NETWORK } from "../../../../utils/index.js";
import provider from "../../../../utils/provider.js";

const ercABI = JSON.parse(readFileSync(new URL("../../../../utils/abis/ERC721.json", import.meta.url), "utf-8"));

export default async (req: VercelRequest, res: VercelResponse): Promise<VercelResponse | void> => {
if (req.method?.toUpperCase() === "OPTIONS") {
return res.status(204).end();
Expand Down
4 changes: 3 additions & 1 deletion api/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { VercelRequest, VercelResponse } from "@vercel/node";
import packageJson from "../package.json" assert { type: "json" };
import { readFileSync } from "fs";

const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));

export default (req: VercelRequest, res: VercelResponse): void => {
res.json({ version: packageJson.version });
Expand Down

0 comments on commit 801d97d

Please sign in to comment.