The @fronnt/core package provides two things:
- the fronnt GraphQL schema and generated TypeScript types
- 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)],
});
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`);
}
});