mirror of
https://github.com/mempool/mempool.git
synced 2025-02-27 16:46:32 +01:00
23 lines
598 B
TypeScript
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;
|