spee.ch/server/routes/api/channelShortId.js

22 lines
513 B
JavaScript
Raw Normal View History

const { handleErrorResponse } = require('helpers/errorHandlers.js');
/*
route to get a short channel id from long channel Id
*/
2018-03-29 02:35:41 +02:00
const channelShortIdRoute = (db) => {
return ({ ip, originalUrl, params }, res) => {
db.Certificate.getShortChannelIdFromLongChannelId(params.longId, params.name)
.then(shortId => {
res.status(200).json(shortId);
})
.catch(error => {
handleErrorResponse(originalUrl, ip, error, res);
});
};
};
module.exports = channelShortIdRoute;