2017-09-07 3 views
0

Ich versuche über eine IP-Adresse eine Verbindung zu einer lokalen Entwicklungsumgebung herzustellen. Ich erhalte eine Fehlermeldung, weil HTTPBatchedNetworkInterface zeigt:Apollo GraphQL: Port für HTTPBatchedNetworkInterface einstellen?

_uri: "http://10.0.1.10/graphql"

... wenn es sein muss:

"http://10.0.1.10:3000/graphql"

Hier ist mein serverseitigen Setup-Code:

const localHostString = '10.0.1.10'; 
const METEOR_PORT = 3000; 
const GRAPHQL_PORT = 4000; 
const server = express(); 

server.use('*', cors({ origin: `http://${localHostString}:${METEOR_PORT}` })); 


server.use('/graphql', bodyParser.json(), graphqlExpress({ 
    schema, 
    context 
})); 

server.use('/graphiql', graphiqlExpress({ 
    endpointURL: '/graphql', 
    subscriptionsEndpoint: `ws://${localHostString}:${GRAPHQL_PORT}/subscriptions` 
})); 

// Wrap the Express server 
const ws = createServer(server); 
ws.listen(GRAPHQL_PORT,() => { 
    console.log(`GraphQL Server is now running on http://${localHostString}:${GRAPHQL_PORT}`); 
    console.log(`GraphiQL available at http://${localHostString}:${GRAPHQL_PORT}/graphiql`); 
    // Set up the WebSocket for handling GraphQL subscriptions 
    new SubscriptionServer({ 
     execute, 
     subscribe, 
     schema 
    }, { 
     server: ws, 
     path: '/subscriptions', 
    }); 
}); 

Wie lautet die korrekte Methode, um die Portnummer in HTTPBatchedNetworkInterface._uri zu bekommen?

Vielen Dank im Voraus für alle Informationen.

Antwort

0

Fest. Mein Framework ist Meteor und ich musste ROOT_URL = 10.0.1.10:3000/ setzen.

Verwandte Themen