Coder Social home page Coder Social logo

apollo-link-local's Introduction

apollo-link-local

This package has been deprecated. Please use apollo-link-schema instead.

Purpose

An Apollo Link to execute queries against a local schema. Useful for SSR query execution or client side schemas.

Installation

npm install apollo-link-local --save

Usage

import { LocalLink } from "apollo-link-local";
import { makeExecutableSchema } from "graphql-tools";

/* Generate an executable schema */
const schema = makeExecutableSchema({ typeDefs, resolvers });

const link = new LocalLink({ schema });

Context

The context generated by ApolloLink is handed to the GraphQL context at execution. If you need context available in a resolver pass it via a Link.

Why is this useful?

If you're building SSR and have access to the executable schema on the same server, you may find LocalLink makes good sense. It enables you to hydrate SSR state from without needing to make network calls.

Client side schemas

GraphQL typically requires mutual agreement to adopt the technology on both the server and client. However, there may be reasons why it's not practical to host a GraphQL service, whether organisational, technical, or otherwise.

Consider the case of a GraphQL service backed by an existing RESTful API. With LocalLink, the schema could exist and resolve to RESTful endpoints entirely client side allowing you to benefit from other Apollo tooling such as caching, query fragments, and more.

apollo-link-local's People

Contributors

imranolas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.