salix/back/methods/url/getUrl.js

31 lines
734 B
JavaScript
Raw Normal View History

2023-10-15 09:08:33 +00:00
module.exports = Self => {
Self.remoteMethod('getUrl', {
2023-10-15 09:08:33 +00:00
description: 'Returns the colling app name',
accessType: 'READ',
2023-10-15 09:08:33 +00:00
accepts: [
{
arg: 'app',
2023-10-15 09:08:33 +00:00
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;
};
};