joyent-portal/packages/cloudapi-gql/src/schema/queries/services.js

20 lines
418 B
JavaScript
Raw Normal View History

2016-10-10 18:37:26 +03:00
const ServiceType = require('../types/service');
const graphql = require('graphql');
const api = require('../../api');
const { GraphQLList } = graphql;
2016-10-10 18:37:26 +03:00
module.exports = {
type: new GraphQLList(ServiceType),
resolve() {
return api.services().then(services => {
return Object.keys(services).map(name => {
2016-10-10 18:37:26 +03:00
return {
url: services[name],
name
};
});
});
}
};