You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example shows, how simple it is to setup a GraphQL instance, which is quite the same, as doing it with Express:
importcreateServer,{HttpPathValidator,HttpRequestHandler,}from"@egomobile/http-server";importschemafrom"./graphql";import{graphqlHTTP}from"express-graphql";asyncfunctionmain(){constapp=createServer();// add GraphQL middleware// with '/graphql' endpointapp.all((request)=>request.url!.startsWith("/graphql"),[graphqlHTTP({// [1] https://graphql.org/learn/schema/// [2] https://graphql.org/learn/queries/
schema,graphiql: true,// use UI})asany,],async()=>{/** this will never be called, but we need this there */});// access UI via// http://localhost:8080/graphqlawaitapp.listen(8080);}main().catch(console.error);