UNPKG

web3.db-fileconnector

Version:

GraphQL System Built on web3 technologies. Web3.DB is an open database built on top of web3 technologies. It is a decentralized, open-source database that allows users to store and query data in a secure and efficient manner. The system is designed to be

38 lines (32 loc) 1.04 kB
import { NextApiRequest, NextApiResponse } from 'next'; import { CeramicClient } from '@ceramicnetwork/http-client'; const CERAMIC_URL = process.env.NEXT_PUBLIC_CERAMIC_URL || 'http://localhost:7007'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { if (req.method !== 'GET') { res.setHeader('Allow', ['GET']); return res.status(405).end(`Method ${req.method} Not Allowed`); } try { const ceramic = new CeramicClient(CERAMIC_URL); // Check if we can connect to Ceramic by getting the supported chains const supportedChains = await ceramic.getSupportedChains(); res.status(200).json({ status: 'ok', ceramic: { url: CERAMIC_URL, connected: true, supportedChains } }); } catch (error) { console.error('Ceramic status check error:', error); res.status(503).json({ status: 'error', ceramic: { url: CERAMIC_URL, connected: false, error: error.message } }); } }