🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

aws-http-api-gateway

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-http-api-gateway

A Framework to handle AWS HTTP APIs with AWS Lambda

0.1.4
latest
Source
npm
Version published
Weekly downloads
5
-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

AWS HTTP API Gateway Framework

npm version Build Status Coverage Status

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 for your own with this repo.

Docs

The framework complete docs can be found here.

Quick start

  • Install via npm
npm i aws-http-api-gateway
  • Setup your serverless function
# serverless.yml
service:
  name: PetStore
provider:
  name: aws
  runtime: nodejs12.x
functions:
  PetsGetManyApi:
    handler: src/apis/pets/get-many.handler
    events:
      - httpApi: 'GET /pets'
  • Code your handler
// 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);

  • Code your data connector (implement with your favorite database)
'use strict';

const dbHandler = require('some-db-handler');

module.exports = class PetsConnector {

	get(getParams) {
		return dbHandler.get(getParams);
	}

};
  • You're ready to go. Just deploy your service!
serverless deploy

Keywords

aws

FAQs

Package last updated on 06 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts