MadStreetDen
MadStreetDen is a Node.js plugin for integrating MadStreetDen Visual Recommendation API into hapi and Express Frameworks.
Hapi Usage
Valid Options for Hapi:
-
url
: mandatory MadStreetDen Recommendation Endpoint -
appID
: mandatory App ID allocated by MadStreetDen -
appSecret
: mandatory App Secret Key allocated by MadStreetDen -
path
: default -/recommend
-
identifier
: query string identifier, default -q
-
numResults
: default -50
-
tags
: Hapi route tags -
connections
: Hapi server connections
Usage:
var Hapi = require('hapi');
var MadStreetDen = require('madstreetden');
var server = new Hapi.Server();
server.connection();
var options = {
url: '<MadStreetDen URL>',
appID: '<MadStreetDen provided appID>',
appSecret: '<MadStreetDen provided appSecret>'
};
server.register({register: MadStreetDen, options: options }, function(err){
console.log(err);
});
Express Usage
Valid Options for Express:
-
url
: mandatory MadStreetDen Recommendation Endpoint -
appID
: mandatory App ID allocated by MadStreetDen -
appSecret
: mandatory App Secret Key allocated by MadStreetDen -
identifier
: query string identifier, default -q
-
numResults
: default -50
var Express = require('express');
var MadStreetDen = require('madstreetden');
var options = {
url: '<MadStreetDen URL>',
appID: '<MadStreetDen provided appID>',
appSecret: '<MadStreetDen provided appSecret>'
};
var server = Express();
server.get('/recommend', MadStreetDen(options));
server.listen({ port: 3000});