New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

gql-mock-server

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gql-mock-server

GraphQL server based on graphql-server-express, preconfigured with cors to use as a mock server

latest
Source
npmnpm
Version
2.1.1
Version published
Maintainers
1
Created
Source

gql-mock-server

GraphQL server based on graphql-server-express, preconfigured with cors to be used as a mock server. You can find more info in this medium post.

How to use

import gql from "gql-mock-server";

const types = `
type User {
  id: ID
  name: String
}

type Query {
  users: [User]
}
`;

const resolvers = {
  Query: {
    users: () => [{ id: "1", name: "Peter" }, { id: "2", name: "Frank" }]
  }
};

gql({ types, resolvers });

API

The gql function accepts the following arguments:

gql(
  schema, // schema object: { types, resolvers }
  {
    context, // context builder: request => ({})
    port, // server port: 3002
    endpoint, // endpoint for the gql server: "/graphql"
  }
)

FAQs

Package last updated on 14 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts