npm.io
1.0.0 • Published 4 years ago

hasura-casing-layer

Licence
MIT
Version
1.0.0
Deps
3
Size
31 kB
Vulns
0
Weekly
0

Hasura Casing Layer

schema builder for adding naming convention transformation layer in front of hasura

Installation

npm install hasura-casing-layer graphql @graphql-tools/wrap

Usage

Express
import express from "express";
import { transformRemoteSchema } from "hasura-casing-layer";
import { graphqlHTTP } from "express-graphql";
import { buildSchema } from "graphql";

const app = express();

const runServer = async () => {
  const hasuraSchema = await transformRemoteSchema({
    uri: "https://yourhasuraendpoint.com",
    // used for instrospection
    hasuraAdminSecret: "supersecret",
  });

  app.use(
    "/graphql",
    graphqlHTTP({
      schema: hasuraSchema,
      graphiql: true,
    })
  );

  app.listen(4000, () => {
    console.log("listeing at localhost:4000 🐐☁");
  });
};

runServer();

License

MIT