Skip to content

Instantly share code, notes, and snippets.

@rdegges
Last active September 19, 2016 18:39
Show Gist options
  • Save rdegges/d2a2469177bb3e58baebac5092759d4d to your computer and use it in GitHub Desktop.
Save rdegges/d2a2469177bb3e58baebac5092759d4d to your computer and use it in GitHub Desktop.
express-stormpath-s3 file upload example
app.get('/upload', stormpath.loginRequired, (req, res, next) => {
// Note the 'public-read' ACL permission.
req.user.uploadFile('./some-file.txt', 'public-read', err => {
if (err) return next(err);
req.user.getCustomData((err, data) => {
if (err) return next(err);
res.send('file uploaded as ' + data.s3['package.json'].href);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment