问题
I would like to use parse and graphQL for a new app. It will essentially work with non logged in users, where people share a link and collaborate on some add hoc item. This will plan a meeting at a certain location.
IS anyone aware of a solution or know of a way to approach this? It seems like it would be an awesome way to make apps.
EDIT
PARSE IS DEAD
回答1:
Yeah, you could certainly build a GraphQL server that was backed by Parse objects!
On the server, you'd build out your GraphQL types as usual; for example, if you had a Todo object and a User object in your Parse Schema (and were using graphql
and graphql-relay
from npm), you might end up with objects like
// Build the GraphQL Todo type.
var GraphQLTodo = new GraphQLObjectType({
name: 'Todo',
fields: () => ({
content: {
type: GraphQLString,
resolve: (obj) => obj.get('content')
},
done: {
type: GraphQLBoolean,
resolve: (obj) => obj.get('done')
},
user: {
type: GraphQLUser,
resolve: (obj) => obj.get('user')
}
}),
});
// Build the connection from User to Todo
var {connectionType, edgeType} = connectionDefinitions({
name: 'UserTodo',
nodeType: GraphQLTodo,
});
// Build the GraphQL User type.
var GraphQLUser = new GraphQLObjectType({
name: 'User',
fields: () => ({
todosConnection: {
type: connectionType,
args: connectionArgs,
resolve: (obj, args) => new Parse.Query(Todo).equalTo('user', obj).find()
}
},
});
If the user has signed in on the client, you could potentially pass up a session token to the server to allow for the parse queries to be made with that session token (for ACL reasons).
来源:https://stackoverflow.com/questions/32570272/how-to-build-a-web-app-with-graphql-parse-com