2017-09-20 14:39:20 -07:00
|
|
|
const logger = require('winston');
|
|
|
|
const passport = require('passport');
|
|
|
|
|
|
|
|
module.exports = (app) => {
|
|
|
|
// route for sign up
|
|
|
|
app.post('/signup', passport.authenticate('local-signup'), (req, res) => {
|
|
|
|
logger.debug('successful signup');
|
2017-10-10 17:46:26 -07:00
|
|
|
res.status(200).json({
|
|
|
|
success : true,
|
|
|
|
channelName : req.user.channelName,
|
|
|
|
channelClaimId: req.user.channelClaimId,
|
|
|
|
shortChannelId: req.user.shortChannelId,
|
|
|
|
});
|
2017-09-20 14:39:20 -07:00
|
|
|
});
|
|
|
|
// route for log in
|
|
|
|
app.post('/login', passport.authenticate('local-login'), (req, res) => {
|
2017-10-09 18:29:40 -07:00
|
|
|
logger.debug('req.user:', req.user);
|
2017-09-20 14:39:20 -07:00
|
|
|
logger.debug('successful login');
|
2017-10-06 16:42:19 -07:00
|
|
|
res.status(200).json({
|
|
|
|
success : true,
|
|
|
|
channelName : req.user.channelName,
|
|
|
|
channelClaimId: req.user.channelClaimId,
|
|
|
|
shortChannelId: req.user.shortChannelId,
|
|
|
|
});
|
2017-09-20 14:39:20 -07:00
|
|
|
});
|
|
|
|
};
|