menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Studio
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

HttpLink vs URI

June 9, 2020 at 11:36pm
What's the effective difference between passing a uri argument to new ApolloClient vs creating an httpLink with the same uri using createHttpLink and passing the link to new ApolloClient?
Basically, should the following two snippets of code behave identically?
#1:
const client = new ApolloClient({ uri: myURI })
#2:
const httpLink = createHttpLink({ uri: myURI })
const client = new ApolloClient({ link: httpLink })
For me, #1 works fine, but I get the Unexpected token F in JSON at position 0 error on using #2. Do people have experience debugging this?
No messages yet