From cdf2b99a86214496037a92befb8a70459f438784 Mon Sep 17 00:00:00 2001 From: rogelio-o Date: Sat, 23 Dec 2017 10:42:41 +0100 Subject: [PATCH 1/2] New raw event and raw callback was not exported. --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index c887d6f..9e1b1b0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,3 +38,7 @@ export { default as ITemplateLoader } from "./lib/types/http/renderEngine/ITempl export { default as ITemplateRenderer } from "./lib/types/http/renderEngine/ITemplateRenderer"; export { default as DevTemplateLoader } from "./lib/http/renderEngine/DevTemplateLoader"; export { default as Template } from "./lib/http/renderEngine/Template"; + +export { default as IRawEvent } from "./lib/types/IRawEvent"; +export { default as IRawCallback } from "./lib/types/IRawCallback"; +export { default as RawEvent } from "./lib/RawEvent"; From 15c5e2b62e940ff64bbccef98597c7047f637de4 Mon Sep 17 00:00:00 2001 From: rogelio-o Date: Sat, 23 Dec 2017 12:34:12 +0100 Subject: [PATCH 2/2] Added abstraction, placeholders for how to and projects info. --- README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 4 +-- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 00268f7..9ece60d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,27 @@ [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1314/badge)](https://bestpractices.coreinfrastructure.org/projects/1314) [![Coverage Status](https://coveralls.io/repos/github/rogelio-o/lambda-framework/badge.svg?branch=master)](https://coveralls.io/github/rogelio-o/lambda-framework?branch=master) [![Build Status](https://travis-ci.org/rogelio-o/lambda-framework.svg?branch=master)](https://travis-ci.org/rogelio-o/lambda-framework) [![npm version](https://badge.fury.io/js/lambda-framework.svg)](https://badge.fury.io/js/lambda-framework) -A framework to create serverless web applications in AWS Lambda. It is based -on Express Framework. +A framework to create serverless web applications with any provider. + +This is the core project, you can use it with an official implementation of a provider +or you can implement your own provider. For more information, please keep reading. + +The idea behind Lambda Framework is that you can use the features of the framework +forgetting the provider you are using. Thus, you can change the provider without +change your code base. The only thing you have to do for change the provider is +change the lib that implements the one provider for other, but the core will be +the same. + +## Lambda Framework projects + +Lambda Framework is very modular. This is because the lambda functions have to be +lightweight. You can use the projects you need in your web application. + +- [Core](https://github.com/rogelio-o/lambda-framework) +- [AWS Lambda implementation](https://github.com/rogelio-o/lambda-framework-aws) +- [DustJS template engine implementation for Lambda Framework](https://github.com/rogelio-o/lambda-framework-dustjs) +- [Website](https://github.com/rogelio-o/lambda-framework-website) +- [Website Resources](https://github.com/rogelio-o/lambda-framework-website-resources) ## Features @@ -11,11 +30,61 @@ on Express Framework. - [x] HTTP requests routing - [x] Other events requests routing - [x] HTTP helpers (redirection, etc) +- [x] Templating - [x] Error handling +- [x] For any serverless provider - [x] Extensible with modules ## How to use it? +### Initialize the App + +The main object is the App. You have to instantiate a new App object and then +you can do what you need with it. +```typescript +import App, { IApp } from "lambda-framework"; + +const app: IApp = new App(); +``` + +A event handling is started passing that event to the App method `handle`. +```typescript +app.handle(event, callback); +``` + +You don't need to care about passing the event to the App handler, you can use the [AWS Lambda implementation](https://github.com/rogelio-o/lambda-framework-aws) or another provider +implementation. These will manage the creation of the raw event and passing it to the handler. +```typescript +import App, { IApp } from "lambda-framework"; +import AWSHandler from "lambda-framework-aws"; + +const app: IApp = new App(); +... +export.handler = AWSHandler(app); +``` + +### Event handling + +TODO + +### HTTP Routing + +TODO + +### HTTP body parsers + +TODO + +### Others HTTP features + +TODO + +### Templating + +TODO + +### More info, API and tutorials + TODO ## Contributions diff --git a/package.json b/package.json index e851e15..4d05d0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lambda-framework", "version": "1.0.19", - "description": "Framework to create web apps in AWS Lambda", + "description": "Framework to create web apps with any provider. This is the core, you can use it with an official provider implementation or you can implement your own provider.", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", "repository": { @@ -21,7 +21,7 @@ }, "keywords": [ "serverless", - "AWS", + "framework", "lambda" ], "author": "Rogelio Orts",