GithubHelp home page GithubHelp logo

ankcorn / beedi Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 28 KB

An opinionated and lightweight library of helpers for building lambdas

JavaScript 100.00%
serverless aws lambdas dependency-injection

beedi's Introduction

BeeDI / ๐Ÿ DI

BeeDI is an opinionated and lightweight library of helpers for building lambdas. It helps you build tidy and testable lambda functions. It simplifies interfacing with aws event sources by limiting and preparsing the input. The aim is to support all the most common event sources.

Simple Example

import { jsonapi } from 'beedi';

async function app(event) {
  // The handler just contains the logic.
  // event.body has been json parsed.
  return {
    message: 'I get json stringified'
  }
}

export const handler = jsonapi(app);

Why choose BeeDI

Its super early days. BeeDI is not used in production anywhere and is just a fun hobby project. I would not recomend using this in production. If you want something with a similar style but more feature complete, better tested, and well maintained check out https://middy.js.org/ and https://laconiajs.io/.

With that disclamer out the way beedi does have some upsides.

  • It's really lightweight. (1kb unminified)
  • It has no external dependencies.
  • The interface is really simple. Each helper takes an object that contains just a couple of parameters.
  • No legacy bagage. No support for callbacks. This means less work to maintain it and it is much lighter. This also could be considered a bad thing. ๐Ÿคทโ€โ™‚๏ธ
  • The internal code is very low abstraction and very simple. Take a peek under the hood. There really is very little magic to make this happen.

If you give it a try let me know by leaving a star

Table of Contents

Installation

Examples

Dependency Injection

import { jsonapi } from 'beedi';
import { pg } from 'pg-sql';

export async function app(event, { pg }) {
  // The handler just contains the logic.
  // event.body has been json parsed.
  await pg.sql('INSERT blah...');
  return {
    message: 'I get json stringified'
  }
}

export const handler = jsonapi(app, { dependencies: () => ({ pg }));

Testing

Contributions

beedi's People

Contributors

ankcorn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.