1.5.6 • Published 7 months ago
@mvf/servicer-apollo v1.5.6
MVF servicer Apollo
Usage
To install the package
Run npm install @mvf/servicer-apollo
Configuration
Set the following environment variables in your project
ENVIRONMENT_FILEshould be set to one ofdevelopment|testing|staging|productionAPOLLO_SERVER_PORTdefaults 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
maketo build the container - Run
make shellto enter the container - Run
npm installto 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.
- Checkout master
git checkout master && git pull - 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.