mempool/lightning-backend/src/api/nodes/channels.routes.ts
2022-07-08 18:55:21 +02:00

23 lines
598 B
TypeScript

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;