mempool/lightning-backend/src/api/nodes/channels.routes.ts

24 lines
598 B
TypeScript
Raw Normal View History

2022-04-29 03:57:27 +04:00
import config from '../../config';
import { Express, Request, Response } from 'express';
import channelsApi from './channels.api';
class ChannelsRoutes {
constructor(app: Express) {
app
.get(config.MEMPOOL.API_URL_PREFIX + 'channels/:public_key', this.$getChannels)
;
}
private async $getChannels(req: Request, res: Response) {
try {
const channels = await channelsApi.$getChannelsForNode(req.params.public_key);
res.json(channels);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
}
export default ChannelsRoutes;