Created
July 11, 2014 20:20
-
-
Save rdegges/d5567652a8a43db80563 to your computer and use it in GitHub Desktop.
Stormpath Express Quickstart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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