bs-aws-amplify
BuckleScript bindings for AWS Amplify client library (work in progress)
Trying out
While work in progress, this package is available at Github Package Registry
To use the GPR, change the registry for the @amblientlight scope before installing, in your project directory, run:
echo "@ambientlight:registry=https://npm.pkg.github.com" >> .npmrc
yarn install @ambientlight/bs-aws-amplify
# if yarn fails with integrity failure, please add dependency manually to package.json and run the following
yarn --update-checksums
Then add @ambientlight/bs-aws-amplify
into bs-dependencies
in your project bsconfig.json
Configuring
- after running
amplify init
oramplify configure
oramplify env add
aws-exports.js
should be generated in the specified src folder (as defined inamplify/.config/project-config.json
) - add bindings for
aws-exports.js
asAWSExports.re
given that source folder issrc/
[@bs.deriving abstract]
type t = {
aws_project_region: string,
aws_cognito_identity_pool_id: string,
aws_cognito_region: string,
aws_user_pools_id: string,
aws_user_pools_web_client_id: string,
aws_content_delivery_bucket: string,
aws_content_delivery_url: string,
aws_appsync_graphqlEndpoint: string,
aws_appsync_region: string,
aws_appsync_authenticationType: string,
aws_appsync_apiKey: string
};
[@bs.module "src/aws-exports"][@bs.val]
external config: t = "default";
- then in your entry (often
Index.re
) runAmplify.configure
:
open AWSAmplify
Amplify.amplify |. Amplify.configure(AWSExports.config);