alexa-ability-express-handler
Advanced tools
Comparing version 0.3.0 to 0.3.1
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.handleAbility = handleAbility; | ||
var _once = require('lodash/once'); | ||
var _handleAbility = require('./handleAbility'); | ||
var _once2 = _interopRequireDefault(_once); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function handleAbility(ability) { | ||
return function abilityHandler(req, res, next) { | ||
// make sure we have a body | ||
if (!req.body) { | ||
noBodyWarning(); | ||
return next(); | ||
} | ||
// TODO validate body? or should ability handle that.. | ||
ability.handle(req.body, function (err, req) { | ||
if (err) return next(err); | ||
res.json(req.toJSON()); | ||
}); | ||
}; | ||
} | ||
// | ||
// Misc warnings | ||
// | ||
var noBodyWarning = (0, _once2.default)(function () { | ||
return console.log('Warning: No request body found.'); | ||
Object.defineProperty(exports, 'handleAbility', { | ||
enumerable: true, | ||
get: function get() { | ||
return _handleAbility.handleAbility; | ||
} | ||
}); |
{ | ||
"name": "alexa-ability-express-handler", | ||
"version": "0.3.0", | ||
"description": "", | ||
"version": "0.3.1", | ||
"description": "Publish an alexa-ability as an express route", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "./scripts/test.sh" | ||
}, | ||
@@ -13,3 +13,17 @@ "repository": { | ||
}, | ||
"keywords": [], | ||
"bugs": { | ||
"url": "http://github.com/nickclaw/alexa-ability-express-handler/issues" | ||
}, | ||
"keywords": [ | ||
"amazon", | ||
"alexa", | ||
"skills", | ||
"skill", | ||
"kit", | ||
"echo", | ||
"ability", | ||
"express", | ||
"middleware", | ||
"alexa-ability" | ||
], | ||
"author": { | ||
@@ -27,8 +41,17 @@ "name": "Nicholas Clawson", | ||
"babel-cli": "^6.4.5", | ||
"babel-eslint": "^4.1.8", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-stage-1": "^6.3.13" | ||
"babel-preset-stage-1": "^6.3.13", | ||
"babel-register": "^6.4.3", | ||
"chai": "^3.4.1", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^4.0.0", | ||
"eslint-plugin-react": "^3.16.1", | ||
"mocha": "^2.3.4", | ||
"sinon": "^1.17.2", | ||
"sinon-chai": "^2.8.0" | ||
}, | ||
"peerDependencies": { | ||
"alexa-ability": "^0.5.0" | ||
"alexa-ability": "^0.6.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# alexa-ability-express-handler | ||
# alexa-ability-express-handler [![Build Status](https://travis-ci.org/nickclaw/alexa-ability-express-handler.svg?branch=master)](https://travis-ci.org/nickclaw/alexa-ability-express-handler) | ||
@@ -3,0 +3,0 @@ ### Example |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
7764
11
121
1
2
13