How to use the amplify-appsync-simulator.AmplifyAppSyncSimulator function in amplify-appsync-simulator

To help you get started, we’ve selected a few amplify-appsync-simulator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-util-mock / src / __e2e__ / utils / index.ts View on Github external
export async function runAppSyncSimulator(config, port?: number, wsPort?: number) {
  const appsyncSimulator = new AmplifyAppSyncSimulator({ port, wsPort });
  await appsyncSimulator.start();
  await appsyncSimulator.init(config);
  return appsyncSimulator;
}
github aws-amplify / amplify-cli / packages / amplify-util-mock / src / api / api.ts View on Github external
async start(context, port: number = 20002, wsPort: number = 20003) {
    try {
      addCleanupTask(context, async context => {
        await this.stop(context);
      });
      this.projectRoot = context.amplify.getEnvInfo().projectPath;
      this.configOverrideManager = ConfigOverrideManager.getInstance(context);
      this.apiName = await this.getAppSyncAPI(context);
      this.ddbClient = await this.startDynamoDBLocalServer(context);
      const resolverDirectory = await this.getResolverTemplateDirectory(context);
      this.resolverOverrideManager = new ResolverOverrides(resolverDirectory);
      this.appSyncSimulator = new AmplifyAppSyncSimulator({
        port,
        wsPort,
      });
      await this.appSyncSimulator.start();
      await this.resolverOverrideManager.start();
      await this.watch(context);
      const appSyncConfig: AmplifyAppSyncSimulatorConfig = await this.runTransformer(context);
      this.appSyncSimulator.init(appSyncConfig);

      await this.generateTestFrontendExports(context);
      await this.generateCode(context);

      context.print.info(`AppSync Mock endpoint is running at ${this.appSyncSimulator.url}`);
    } catch (e) {
      context.print.error(`Failed to start API Mock endpoint ${e}`);
    }

amplify-appsync-simulator

An AppSync Simulator to test AppSync API.

Apache-2.0
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis