Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jormaechea/aws-http-api-gateway
A framework to implement AWS HTTP APIs with ease
https://github.com/jormaechea/aws-http-api-gateway
api api-framework api-gateway api-gateway-v2 aws framework http-api serverless
Last synced: 27 days ago
JSON representation
A framework to implement AWS HTTP APIs with ease
- Host: GitHub
- URL: https://github.com/jormaechea/aws-http-api-gateway
- Owner: jormaechea
- Created: 2020-03-09T04:04:45.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T09:41:21.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T14:38:58.765Z (2 months ago)
- Topics: api, api-framework, api-gateway, api-gateway-v2, aws, framework, http-api, serverless
- Language: JavaScript
- Size: 229 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# AWS HTTP API Gateway Framework
[![npm version](https://badgen.net/npm/v/aws-http-api-gateway)](https://www.npmjs.com/package/aws-http-api-gateway)
[![Build Status](https://travis-ci.org/jormaechea/aws-http-api-gateway.svg?branch=master)](https://travis-ci.org/jormaechea/aws-http-api-gateway)
[![Coverage Status](https://coveralls.io/repos/github/jormaechea/aws-http-api-gateway/badge.svg?branch=master)](https://coveralls.io/github/jormaechea/aws-http-api-gateway?branch=master)**AWS API Gateway - HTTP API Framework** -- _Also called API Gateway v2_.
A framework to easily implement HTTP APIs in AWS API Gateway. Implement CRUD operations in less than 100 lines of code!
Test a working [demo](https://github.com/jormaechea/aws-http-api-gateway-demo) for your own with this repo.
# Docs
The framework complete docs can be found [here](docs/README.md).
## Quick start
1. Install via npm
```bash
npm i aws-http-api-gateway
```2. Setup your serverless function
```yml
# serverless.yml
service:
name: PetStore
provider:
name: aws
runtime: nodejs12.x
functions:
PetsGetManyApi:
handler: src/apis/pets/get-many.handler
events:
- httpApi: 'GET /pets'
```3. Code your handler
```js
// src/apis/pets/get-many.js
'use strict';const { GetManyApi, ApiHandler } = require('aws-http-api-gateway');
const PetConnector = require('../../connectors/pets');
const petConnector = new PetConnector();
class PetGetManyApi extends GetManyApi {
get dataConnector() {
return petConnector;
}};
module.exports.handler = ApiHandler(PetGetManyApi);
```
4. Code your data connector (implement with your favorite database)
```js
'use strict';const dbHandler = require('some-db-handler');
module.exports = class PetsConnector {
get(getParams) {
return dbHandler.get(getParams);
}};
```5. You're ready to go. Just deploy your service!
```bash
serverless deploy
```