Socket
Book a DemoInstallSign in
Socket

echo-expressive

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

echo-expressive

A minimalist framework for Alexa Skill Kit apps running on Amazon Lambda

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Expressive Build Status

A minimalist framework for Alexa Skills Kit apps running on Amazon Lambda (or as a web service), inspired by the syntax of Express.js.

Usage

NPM

var expressive = require('echo-expressive');
var app = expressive(MY_APP_ID); // app id is optional, but filters requests

// install a middleware, they way you'd expect
app.use(function(req, res, next) {
    // read session attributes with the key
    if (req.attr('user')) {
        // it's already set, move along
        next();
        return;
    }

    // asynchronous processing
    User.find(req.session.user.userId, function(err, user) {
        if (err) return next(err);

        // set session attributes with key and value
        req.attr('user', user);
        next();
    });
});

// if you want to process slots for intent requests,
//  you can do that, too
app.slot('recipient-name', function(req, res, next, name) {
    // This will be called after the above, as expected,
    //  and only when the `recipient-name` slot was provided
    //  in an IntentRequest.

    User.findByName(name, function(err, recipient) {
        if (err) return next(err);

        req.attr('recipient', recipient);
        next();
    });
});


// instead of get() or post(), use Echo verbs.
// start(), launch(), intent(), and end()
app.start(function(req) {
    // this is called when a new Session has started
    // You can use it to prepare any resources
});

app.launch(function(req, res) {
    // LaunchRequest received
    res.tell("Welcome to my app");
});

app.intent('SendIntent', function(req, res) {
    // specific IntentRequest received
    res.ask("What would you like to send?");
});

app.intent('SendWithMessageIntent', function(req, res) {
    // specific IntentRequest received
    res.tell("Message sent!");
});

app.end(function(req) {
    // this is called when a Session has ended.
    // You can use it to clean up any resources
});

// install for use on Lambda
app.handle(module.exports);
// or, listen like a web service
app.listen(8080);

Future Work

  • Abstract routes further so sets of routes can be mounted like in Express

Keywords

echo

FAQs

Package last updated on 19 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.