Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.47 KB

README.md

File metadata and controls

55 lines (42 loc) · 1.47 KB

Documentation

core

The @fronnt/core package provides two things:

  1. the fronnt GraphQL schema and generated TypeScript types
  2. an envelop plugin, which can be used in any envelop based environment
import { envelop, useEnvelop } from '@envelop/core';
import { createFronntEnvelop } from '@fronnt/core';

const connectors = [
  /*...*/
];

const fronntEnvelop = createFronntEnvelop(connectors);

const myEnvelop = envelop({
  plugins: [useEnvelop(fronntEnvelop)],
});

server

To make it easy to get started, the @fronnt/server package provides an optionated GraphQL HTTP server implementation based on fastify and graphql-helix.

import { createServer } from '@fronnt/server';

const otherEnvelopPlugins = [
  /*...*/
];
const connectors = [
  /*...*/
];

createServer(connectors, otherEnvelopPlugins).listen(4000, (err) => {
  if (err) {
    console.error('An error occured while starting the fronnt server', err);
  } else {
    console.log(`🚀 fronnt server is running at http://localhost:4000`);
  }
});