2.0.0-beta.11 • Published 3 months ago

ruru v2.0.0-beta.11

Weekly downloads
1
License
MIT
Repository
github
Last release
3 months ago

ruru

A Grafast-enhanced distribution of GraphiQL.

PRERELEASE: this is pre-release software; use at your own risk and do not embed into public-facing projects. This will likely change a lot before it's ultimately released. The pre-release nature also explains the shocking lack of documentation.

Usage - CLI

We recommend that you install this alongside http-proxy:

yarn add http-proxy ruru

Then you can run something like the following to automatically proxy requests (bypassing CORS issues):

yarn ruru -SPe http://localhost:5678/graphql

Usage:

ruru

Run a Ruru server

Options:
      --help                   Show help                                                                      [boolean]
      --version                Show version number                                                            [boolean]
  -e, --endpoint               endpoint for query and mutation operations
                                                                    [string] [default: "http://localhost:5678/graphql"]
  -p, --port                   port number to run the server on                                [number] [default: 1337]
  -P, --proxy                  Proxy requests to work around CORS issues                                      [boolean]
  -S, --subscriptions          enable subscriptions, converting --endpoint to a ws:// URL    [boolean] [default: false]
  -s, --subscription-endpoint  endpoint for subscription operations (overrides -S)                             [string]

Usage - bundle

<!-- optionally import Prettier for query formatting -->
<script src="https://unpkg.com/prettier@1.13.0/standalone.js"></script>
<script src="https://unpkg.com/prettier@1.13.0/parser-graphql.js"></script>
<!-- Required below here -->
<div id="ruru-root"></div>
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" />
<script crossorigin src="https://unpkg.com/ruru/bundle/ruru.min.js"></script>
<script>
  const { React, createRoot, Ruru } = RuruBundle;
  const tree = React.createElement(Ruru, {
    endpoint: "/graphql",
  });
  const container = document.getElementById("ruru-root");
  const root = createRoot(container);
  root.render(tree);
</script>

Usage - library

import { Ruru } from "ruru";

React.render(<Ruru endpoint="/graphql" />);

Usage - middleware

import { ruruHTML } from "ruru/server";

// ...

app.get("/", (req, res, next) => {
  res.writeHead(200, { "Content-Type": "application/html" });
  return res.end(
    ruruHTML({
      endpoint: "/graphql",
    }),
  );
});

Why "ruru"?

Jem and I are big fans of the late Terry Pratchett's Discworld universe. The city at the centre of many a Discworld tale is the twin-city city-state of Ankh-Morpork. A "morepork" is a type of New Zealand owl, known in Māori as "ruru." Owls have excellent sight, and Ruru helps you to get an insight into not just the inputs and outputs of your API, but also what it does internally.

RURU is also an abbreviation for checks to use when gathering information: "is it Reliable, Up-to-date, Relevant, and Useful?" We hope that you'll find Ruru to be all those things!

... in the Quechua languages, the term "ruru" may refer to, among other things, "testicle." So when your GraphQL operation isn't doing what you expect and you're thinking to yourself "this is b*ll*cks," then you'll know this is a job for Ruru!

GNU Terry Pratchett

2.0.0-beta.11

3 months ago

2.0.0-beta.10

5 months ago

2.0.0-beta.9

5 months ago

2.0.0-beta.8

6 months ago

2.0.0-beta.7

7 months ago

2.0.0-beta.6

7 months ago

2.0.0-beta.5

8 months ago

2.0.0-alpha.7

10 months ago

2.0.0-alpha.8

10 months ago

2.0.0-alpha.9

10 months ago

2.0.0-alpha.11

9 months ago

2.0.0-alpha.10

10 months ago

2.0.0-alpha.4

12 months ago

2.0.0-alpha.5

12 months ago

2.0.0-alpha.6

11 months ago

2.0.0-beta.2

9 months ago

2.0.0-beta.1

9 months ago

2.0.0-beta.4

8 months ago

2.0.0-beta.3

8 months ago

2.0.0-0.5

1 year ago

2.0.0-0.6

1 year ago

2.0.0-0.7

1 year ago

2.0.0-0.8

1 year ago

2.0.0-0.9

1 year ago

2.0.0-alpha.3

12 months ago

2.0.0-1.1

1 year ago

2.0.0-alpha.1

1 year ago

2.0.0-1.2

1 year ago

2.0.0-alpha.2

1 year ago

2.0.0-0.13

1 year ago

2.0.0-0.12

1 year ago

2.0.0-0.11

1 year ago

2.0.0-0.10

1 year ago

2.0.0-0.0

1 year ago

2.0.0-0.1

1 year ago

2.0.0-0.2

1 year ago

2.0.0-0.3

1 year ago

2.0.0-0.4

1 year ago

1.0.0

7 years ago