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.