Instantly share code, notes, and snippets.

@Mirch /sign.js
Created Nov 30, 2018

Embed
What would you like to do?
app.post('/api/login', (req, res) => {
// Mock user
const user = {
id: 1,
username: '1055984',
email: '1055984@ucn.com'
};
jwt.sign({ user }, 'secretkey',
{ expiresIn: '30s' }, (err, token) => {
res.json({
token
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment