Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created July 11, 2014 20:20
Show Gist options
  • Save rdegges/d5567652a8a43db80563 to your computer and use it in GitHub Desktop.
Save rdegges/d5567652a8a43db80563 to your computer and use it in GitHub Desktop.
Stormpath Express Quickstart
var express = require('express');
var stormpath = require('express-stormpath');
var app = express();
app.use(stormpath.init(app, {
apiKeyFile: process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] + '/.stormpath/apiKey.properties',
secretKey: 'some_random_long_string_here',
application: 'https://api.stormpath.com/v1/applications/xxx',
}));
app.get('/', function(req, res) {
res.send('home page!');
});
app.get('/secret', stormpath.loginRequired, function(req, res) {
res.send('secret page!');
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment