GraphQL, built for Deno - a native GraphQL caching client and server module
GraphQL, built for Deno - a native GraphQL caching client and server module
Obsidian is Deno's first native GraphQL caching client and server module. Boasting lightning-fast caching and fetching capabilities alongside headlining normalization and rebuilding strategies, Obsidian is equipped to support scalable, highly performant applications.
With additional support for use in server-side rendered React apps built with Deno, full stack integration of Obsidian enables a fast and flexible caching solution.
…
…
import { ObsidianWrapper } from 'https://deno.land/x/obsidian/clientMod.ts';
const App = () => {
return (
);
};
import { useObsidian } from 'https://deno.land/x/obsidian/clientMod.ts';
const MovieApp = () => {
const { query } = useObsidian();
const [movies, setMovies] = (React as any).useState('');
const queryStr = `query {
movies {
id
title
releaseYear
genre
}
}
`;
return (
{movies}
{
query(queryStr)
.then(resp => setMovies(resp.data))
}}
>Get Movies
);
};
import { useObsidian } from 'https://deno.land/x/obsidian/clientMod.ts';
const MovieApp = () => {
const { mutate } = useObsidian();
const [movies, setMovies] = (React as any).useState('');
const queryStr = `mutation {
addMovie(input: {title: "Cruel Intentions", releaseYear: 1999, genre: "DRAMA" }) {
id
title
releaseYear
genre
}
}
`;
return (
{movies}
{
mutate(queryStr)
.then(resp => setMovies(resp.data))
}}
>Get Movies
);
}
In order to utilize server side caching, a Redis instance must be available and running. Redis installation and quick-start documentation can be found here. Make sure to keep a redis instance running whenever the application is utilizing server side caching to avoid running into issues.
To connect Obsidian to Redis, create a .env file in the root directory of the application with the following information:
REDIS_HOST= //string of redis host name, typically defaulted to '127.0.0.1' by Redis
Be sure to also specify the Redis TCP port by passing in the port number as an argument into Obsidian Router (see Selecting options for the Router above).
Information and instructions on how to use our developer tool can be found here
works with Obsidian 8.0
open-source-labs/obsidian-developer-tool
Github for a demo with some example code to play with:
David Kim
David Norman
Eileen Cho
Joan Manto
Alex Lopez
Kevin Huang
Matthew Weisker
Ryan Ranjbaran
Derek Okuno
Liam Johnson
Josh Reed
Jonathan Fangon
Liam Jeon
Yurii Shchyrba
Linda Zhao
Ali Fay
Anthony Guan
Yasir Choudhury
Yogi Paturu
Michael Chin
Dana Flury
Sardor Akhmedov
Christopher Berry
Olivia Yeghiazarian
Michael Melville
John Wong
Kyung Lee
Justin McKay
Patrick Sullivan
Cameron Simmons
Raymond Ahn
Alonso Garza
Burak Caliskan
Matt Meigs
Travis Frank
Lourent Flores
Esma Sahraoui
Derek Miller
Eric Marcatoma
Spencer Stockton
No open issues yet, or sync has not completed.