Closed akelmj closed 2 years ago
Hi,
You can directly use graphql
from graphql package without using an HTTP server, pass it the schema and a query to use it:
import { graphql } from 'graphql';
import mySchema from '_path_to_schema';
const queryString = `{
user {
id
email
}
}`;
const query = await graphql(mySchema, queryString);
work , thanks.
Hi, @akelmj you can close the issue now. Thanks :)
:)
Hi,
i want to call graphql query from the same server , this is my code example:
` const PORT = 4000;
var app = express();
app.use( '/graphql', graphqlHTTP({ schema: schema, graphiql: true, }), );
app.get('/posts', function (req, res) {
let myquery =
query{ posts{ id title } }
;})
app.listen(PORT); `
is it possible?
thanks.