當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript aws-amplify.configure函數代碼示例

本文整理匯總了TypeScript中aws-amplify.configure函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript configure函數的具體用法?TypeScript configure怎麽用?TypeScript configure使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了configure函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import Amplify from 'aws-amplify';
import aws_exports from '../aws-exports';
import { AmplifyAngularModule, AmplifyService } from 'aws-amplify-angular';
Amplify.configure(aws_exports);

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AmplifyAngularModule
  ],
  providers: [
    AmplifyService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
開發者ID:ChhorvornBradley,項目名稱:parkingGarage,代碼行數:23,代碼來源:app.module.ts

示例2: enableProdMode

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import Amplify from 'aws-amplify';
import amplify from './aws-exports';
Amplify.configure(amplify);

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.log(err));
開發者ID:ChhorvornBradley,項目名稱:parkingGarage,代碼行數:14,代碼來源:main.ts

示例3: createLinkWithCache

import { ApolloLink } from 'apollo-link'
// *aws amplify imports - download from mobile hub
import Amplify, { Auth } from 'aws-amplify'
import awsconfig from './aws-exports'
// *aws appsync imports - download from AppSync
import AWSAppSyncClient, { createAppSyncLink, createLinkWithCache } from 'aws-appsync/lib'
import { withClientState } from 'apollo-link-state'
import appSyncConfig from './AppSync'

// *configure using mobilehub export
Amplify.configure(awsconfig)

// import local state
import defaultState from './data/setup/DefaultState'
import typeDefs from './data/setup/TypeDefs'
import { mutationResolvers } from './data/resolvers/Mutations'

// create local state
const stateLink = createLinkWithCache((cache: any) =>
  withClientState({
    defaults: defaultState,
    resolvers: { ...mutationResolvers },
    typeDefs,
    cache
  })
)

// subscription is enabled by default
const appSyncLink = createAppSyncLink({
  url: appSyncConfig.graphqlEndpoint,
  region: appSyncConfig.region,
開發者ID:hanming2033,項目名稱:React-Starter-AWS-AppSync,代碼行數:31,代碼來源:AWSApolloClient.ts

示例4: enableProdMode

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import Amplify from 'aws-amplify';

Amplify.configure({
  Auth: {

    // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
    identityPoolId: environment.cognitoIdentityPoolId,

    // REQUIRED - Amazon Cognito Region
    region: environment.region
  }
});


if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
開發者ID:cr-gustavofernandes,項目名稱:aws-serverless-workshops,代碼行數:25,代碼來源:main.ts


注:本文中的aws-amplify.configure函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。