1.1.5 • Published 2 years ago

sls-lambda-router v1.1.5

Weekly downloads
22
License
MIT
Repository
github
Last release
2 years ago

Serverless Lambda Router

A router for AWS Lambda serverless applications written in TypeScript that makes use of @Decorators to register resource handlers and stuff.

Usage

(more details to come)

/** play.resource.ts **/
export class PlayResource {
  
  @GET(["/my/api/v1/play/:game"])
  public playGame(@HttpEvent event: APIGatewayEvent,
                  @PathParam("game") game: string): Promise<Response> {
    
    const game = Game.get(game);
    return game.start().then((res) => {
        return Response.ok(res, "application/json");
    }).catch ((err) => {
        throw new BadRequestException(err);
    });
}

/** handler.ts **/
class Appllication {

  public handler(event: APIGatewayEvent, context: Context, callback: Callback) {
    this.router.registerResource(new PlayResource());
    this.router.route(event, context, callback).then(() => {
        // some final stuff if everything went well
    }).catch((err) => {
        // some final stuff if something went wrong
    });
  }
}
1.1.5

2 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5-b

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1-a

7 years ago

0.0.1

7 years ago