joyent-portal/cloudapi-graphql/src/schema/queries/services.js

22 lines
424 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;
module.exports = {
type: new GraphQLList(ServiceType),
resolve() {
return api.services().then((services) => {
return Object.keys(services).map((name) => {
return {
url: services[name],
name
};
});
});
}
};