Exemple #1
0
        public static void Initialize()
        {
            if (StarWarsHttpServer != null) //already initialized
            {
                return;
            }
            if (File.Exists(LogFilePath))
            {
                File.Delete(LogFilePath);
            }

            // create server and Http graphQL server
            var app            = new StarWarsApp();
            var starWarsServer = new GraphQLServer(app);

            starWarsServer.RegisterModules(new StarWarsApiModule());
            StarWarsHttpServer = new GraphQLHttpServer(starWarsServer);
            StartWebHost();

            // Write schema doc to file
            var schemaDoc = starWarsServer.Model.SchemaDoc;

            File.WriteAllText("_starWarsSchema.txt", schemaDoc);


            Client = new GraphQLClient(GraphQLEndPointUrl);
            Client.RequestCompleted += Client_RequestCompleted;
        }
Exemple #2
0
        private GraphQLHttpServer CreateGraphQLHttpServer()
        {
            var app    = new StarWarsApp();
            var server = new GraphQLServer(app);

            server.RegisterModules(new StarWarsApiModule());
            return(new GraphQLHttpServer(server));
        }
 // Begin/end request method
 public void BeginRequest(IRequestContext request)
 {
     // Get app instance
     _app = (StarWarsApp)request.App;
 }