0.0.1 • Published 5 years ago

@paladin-privacy/server v0.0.1

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
5 years ago

Paladin Server

This library is a generic Typescript implementation of the Paladin Server API. It includes all of the logic for managing a Paladin server, without specifically integrating that logic to a particular server environment.

To make queries against the server:

// Define our query, context, and variables; these should usually be provided by the user
const query = `
  query GetProfileQuery($id: String!) {
    profile(id: $id) {
      id
      nickname
      data
    }
  }
`;
const context = {};
const variables = { id: '1234' };

// Define our database; MemoryPersistence is just an in-memory js object that can be used for temporary storage. 
// For a real implementation, you'll want to implement the Persistence interface to support some type of
// data persistence. A database for example.
const memory = new MemoryPersistence();
const graphql = createGraphQL(memory);

// Execute our query and get a response
const response = graphql(query, context, variables);

// Get the result
console.log(response.data.profile);