dbartholomae / lambda-middleware

A collection of middleware for AWS lambda functions.
https://dbartholomae.github.io/lambda-middleware/
MIT License
152 stars 18 forks source link

Add typeorm middleware for connecting to a database #14

Closed dbartholomae closed 4 years ago

dbartholomae commented 4 years ago

Is your feature request related to a problem? Please describe. Many of our lambdas need to connect to a relational database with help of typeorm. This logic could be abstacted out similar to middy's db-manager. This should also allow to wire the database into a dependency injection framework.

Describe the solution you'd like A minimal version should work like this, reading the setup needed from the typeorm-typical env vars.

export const handler = connectDatabase({
  container: Container
})
( ..)

Potentially should allow to get credentials via AWS.

Describe alternatives you've considered Potentially this should be more abstract, allowing other kinds of ORMs like knex. Currently I think a simple middleware focussing only on typeorm makes more sense, with individual middlewares for individual ORMs.

dbartholomae commented 4 years ago

Closing this as there currently is no interest. Feel free to comment here if you think this should be opened again.

amouly commented 3 years ago

@dbartholomae I'm interested on this, both for Dependency Injection and also for TypeORM.

Is something created for this already?

dbartholomae commented 3 years ago

No one worked on this yet as far as I know.