spee.ch/server/routes/api/channelShortId.js
2018-04-26 18:50:47 -07:00

20 lines
512 B
JavaScript

const { handleErrorResponse } = require('../utils/errorHandlers.js');
const db = require('../../models');
/*
route to get a short channel id from long channel Id
*/
const channelShortIdRoute = ({ 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;