node-go/server/controllers/api/apiIndex.js

21 lines
476 B
JavaScript
Raw Permalink Normal View History

2020-01-18 00:32:40 +00:00
const userQueries = require('../../data/queries/user');
const verifyToken = require('../../services/verifyToken');
const apiIndex = async (req, res, next) => {
try {
if (req.cookies && req.cookies.token) {
const token = req.cookies.token;
const verifiedToken = await verifyToken(token);
res.status(200).send(verifiedToken.user)
2020-01-18 00:32:40 +00:00
}
res.status(200).json()
}
catch (err) {
2020-01-18 00:32:40 +00:00
res.status(500).json(err);
}
}
module.exports = {
apiIndex
}