Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add the /alexa endpoint
var mbaasApi = require('fh-mbaas-api');
var express = require('express');
var mbaasExpress = mbaasApi.mbaasExpress();
var cors = require('cors');
// list the endpoints which you want to make securable here
var securableEndpoints;
securableEndpoints = ['/hello', '/feeds', '/alexa'];
var app = express();
// Enable CORS for all requests
// Note: the order which we add middleware to Express here is important!
app.use('/sys', mbaasExpress.sys(securableEndpoints));
app.use('/mbaas', mbaasExpress.mbaas);
// allow serving of static files from the public directory
app.use(express.static(__dirname + '/public'));
// Note: important that this is added just before your own Routes
app.use('/hello', require('./lib/hello.js')());
app.use('/feeds', require('./lib/feeds.js')());
app.use('/alexa', require('./lib/alexa.js')());
// Important that this is last!
var port = process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8001;
var host = process.env.OPENSHIFT_NODEJS_IP || '';
app.listen(port, host, function() {
console.log("App started at: " + new Date() + " on port: " + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment