@mvf/servicer-apollo
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

MVF servicer Apollo

Usage

To install the package

Run npm install @mvf/servicer-apollo

Configuration

Set the following environment variables in your project

  • ENVIRONMENT_FILE should be set to one of development | testing | staging | production
  • APOLLO_SERVER_PORT defaults to 80

Servicer Apollo

To setup Servicer Apollo you will need an entrypoint.ts or equivalent file.

import { Application, DaemonCommand } from "@mvf/servicer";
import { Apollo, Resolvers, IApolloConfig } from "@mvf/servicer-apollo";
import { ApolloEventSources } from "EventSources";
import schema, { actionResolvers, dataSources, graphqlResolvers } from "Services/Apollo";
import { verifyToken } from "Services/Middleware/Auth/Auth";

const environmentConfig: IApolloConfig = process.env.ENVIRONMENT_FILE === "development" ? {
  playground: true,
  introspection: true,
} : {};

const config: IApolloConfig = {
  context: verifyToken,
  dataSources,
  ...environmentConfig,
};

const setupApplication = async () => {
  const application = new Application();
  const resolvers = new Resolvers(ApolloEventSources, actionResolvers(), graphqlResolvers());
  application.addCommands(
    new DaemonCommand(new Apollo(resolvers, schema, config)),
  );
  await application.run();
};

setupApplication();

Contributing

Setup

  • Run make to build the container
  • Run make shell to enter the container
  • Run npm install to install dependencies

Refer to package.json for commands

After merging

After you have merged a PR to master, you need to rebuild and publish your changes.

  1. Checkout master git checkout master && git pull
  2. Use one of the following make publish commands to publish changes:
    • make publish kind=patch - Use this if your change is a bug fix and is backwards compatible.
    • make publish kind=minor - Use this if your change adds new functionality and is backwards compatible.
    • make publish kind=major - Use this if your change is not backwards compatible.

Readme

Keywords

none

Package Sidebar

Install

npm i @mvf/servicer-apollo

Weekly Downloads

2

Version

1.4.4

License

MIT

Unpacked Size

225 kB

Total Files

104

Last publish

Collaborators

  • laleh.koupaei
  • gijserensteinmvf
  • arnicsm
  • russellwind-mvf
  • dovydas.rupsys
  • michaelkingmvf
  • john.felton
  • jrrsmvf