salix/loopback/common/methods/application/getUrl.js

31 lines
714 B
JavaScript
Raw Normal View History

2023-10-15 09:08:33 +00:00
module.exports = Self => {
Self.remoteMethodCtx('getUrl', {
description: 'Returns the colling app name',
accepts: [
{
arg: 'appName',
type: 'string',
required: false
}
],
returns: {
type: 'object',
root: true
},
http: {
path: `/getUrl`,
verb: 'get'
}
});
Self.getUrl = async(appName = 'salix') => {
2023-10-16 16:24:58 +00:00
const {url} = await Self.app.models.Url.findOne({
2023-10-15 09:08:33 +00:00
where: {
appName,
enviroment: process.env.NODE_ENV || 'development'
}
});
return url;
};
};