0.1.6 • Published 8 years ago

azure-alexa-mock-context v0.1.6

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Azure-Alexa-Mock-Context

Purpose

The purpose of this project is to provide a mock AWS context file that can be used in an Azure (or Firebase) function app instead of in an AWS Lambda. This allows you to use other providers of serverless infrustructure and still use the alexa-sdk provided by Amazon.

Importing

This module was written in typescript, so typings are included.

import { Context } from 'azure-alexa-mock-context';

And then in your code you can generate a new context by generating a new class instance:

let context = new Context('SkillName', ctx); where ctx is the Azure context that is passed in from your HttpRequest statement in the function.

Example

export const index = (context: HttpContext, req: HttpRequest) => {
    context.log(JSON.stringify(req, null, 2));
    const awsContext = new Context('CalorieCounter', context);
    let alexa = Alexa.handler(req.body, awsContext);
    let handlers: Alexa.Handlers<{}> = {
        "AboutIntent": function() {
            let output: string = 'This skill was created by Seth Coussens @sethcoussens';
            this.emit(":tellWithCard", output, "GetNewFactIntent", output);
        }
    };
    alexa.registerHandlers(handlers);
    alexa.execute();
}
0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago