import {SchemaQuery} from '@graphql/schema-query';
var schemaQuery = new SchemaQuery({schema: schemaJson});
var query = schemaQuery.mutation.sendChatMessageQuery({conversation_id: 1, sender: {uid: 1}, content: 'test', type: 'chat'});
import {SchemaApi} from '@graphql/schema-query';
var schemaApi = new SchemaApi({schema: schemaJson});
var query = schemaApi.mutation.sendChatMessage({
url,
headers,
params: {
conversation_id: 1,
content: 'hi'
},
response
});
import express from 'express';
import bodyParser from 'body-parser';
import {SchemaRestApi} from '@graphql/schema-query';
import schema from './schema';
let app = express();
let jsonParser = bodyParser.json()
let schemaRestApi = new SchemaRestApi({schema, middleware: true}, () => {
app.post('/sendMessage', jsonParser, this.mutation.sendChatMessage((req) => {
return {
rootValue: {user: req.data_.user, app: req.data_.app},
response: '{message_id, content, createdAt, updatedAt}',
ignoreData: true
};
}));
app.listen(8000);
});