node-go/packages/play-node-go/server/controllers/auth.js
2020-02-05 16:44:31 -08:00

28 lines
No EOL
451 B
JavaScript

const knex = require('../data/db')
const signToken = require('../services/signToken');
const signUp = async (req, res, next) => {
const user = req.body;
try {
knex('user')
.insert(user)
.then(newUser => {
signToken(res, newUser[0]);
res.send('ok').status(200);
}
)
}
catch (err) {
res.status(500).json(err)
}
}
const login = (req, res, next) => {
}
module.exports = {
signUp,
login
}