0.0.1 • Published 4 years ago

amplify-category-openapi v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

License Dependencies Total alerts Language grade: JavaScript Sponsored Buy me a coffee

OpenAPI plugins / libraries for AWS Amplify

Usage

Install amplify-openapi-backend plugin

npm install -g amplify-openapi-backend
amplify plugin scan

Create a new API resource with OpenAPI Backend (Integration with API Gateway) template

amplify api add
# ? Please select from one of the below mentioned services: REST
# ? Provide a friendly name for your resource to be used as a label for this category in the project: myopenapi
# ? Provide a path (e.g., /book/{isbn}): /api
# ? Choose a Lambda source Create a new Lambda function
# ? Provide a friendly name for your resource to be used as a label for this category in the project: openapibackend
# ? Provide the AWS Lambda function name: openapibackend
# ? Choose the function runtime that you want to use: NodeJS
# ? Choose the function template that you want to use: OpenAPI Backend (Integration with API Gateway)
# ...
amplify push

Install amplify-openapi-client frontend library

npm install --save amplify-openapi-client

Configure the library to use with Amplify

import OpenAPI from "amplify-openapi-client";
import awsconfig from "./aws-exports";

const api = new OpenAPI();
api.configure(awsconfig);

api.getClient({ name: "myopenapi", path: "/api" }).then(async client => {
  const pets = await client.getPets();
});

Development

npm install
npm run watch-build

Contributing

Amplify OpenAPI Monorepo is Free and Open Source Software. Issues and pull requests are more than welcome!