salix/back/methods/url/getUrl.js

31 lines
730 B
JavaScript

module.exports = Self => {
Self.remoteMethod('getUrl', {
description: 'Returns the colling app name',
accessType: 'READ',
accepts: [
{
arg: 'app',
type: 'string',
required: false
}
],
returns: {
type: 'object',
root: true
},
http: {
path: `/getUrl`,
verb: 'get'
}
});
Self.getUrl = async(appName = 'salix') => {
const url = await Self.app.models.Url.findOne({
where: {
appName,
environment: process.env.NODE_ENV || 'dev'
}
});
return url?.url;
};
};