Socket
Socket
Sign inDemoInstall

graphql-playground-html

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-playground-html

GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).


Version published
Weekly downloads
268K
decreased by-0.15%
Maintainers
2
Weekly downloads
 
Created

What is graphql-playground-html?

The graphql-playground-html npm package provides a way to embed GraphQL Playground, a powerful GraphQL IDE, into your web applications. It allows developers to interact with their GraphQL APIs through a user-friendly interface, making it easier to test queries, mutations, and subscriptions.

What are graphql-playground-html's main functionalities?

Embedding GraphQL Playground

This code sample demonstrates how to embed GraphQL Playground into an HTML page. It includes the necessary CSS and JavaScript files from a CDN and initializes the playground with a specified GraphQL endpoint.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>GraphQL Playground</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/static/css/index.css" />
    <link rel="shortcut icon" href="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/favicon.png" />
    <script src="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/static/js/middleware.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script>
      window.addEventListener('load', function (event) {
        GraphQLPlayground.init(document.getElementById('root'), { endpoint: '/graphql' })
      })
    </script>
  </body>
</html>

Customizing GraphQL Playground

This code sample shows how to customize the GraphQL Playground by setting various options such as the editor theme and cursor shape. These settings can be adjusted to fit the developer's preferences.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>GraphQL Playground</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/static/css/index.css" />
    <link rel="shortcut icon" href="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/favicon.png" />
    <script src="https://cdn.jsdelivr.net/npm/graphql-playground-html@latest/build/static/js/middleware.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script>
      window.addEventListener('load', function (event) {
        GraphQLPlayground.init(document.getElementById('root'), {
          endpoint: '/graphql',
          settings: {
            'editor.theme': 'dark',
            'editor.cursorShape': 'line'
          }
        })
      })
    </script>
  </body>
</html>

Other packages similar to graphql-playground-html

Keywords

FAQs

Package last updated on 30 Aug 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc