An error occurred while loading the file. Please try again.
api.js 582 bytes
// ==== USER ACOOUNT API ====
var dbconn = require('./dbconn')
module.exports = function (app) {
    //console.log(dbconn);
    //var con = dbconn.connection
    app.get('/api/v1/profile', function (req, res) {
        if (req.isAuthenticated()) {
            // read data based on email
            dbconn.user.query('SELECT * FROM user WHERE email="'+req.user.email+'"', function (err, rows, fields) {
                if (err) throw err
                res.send(rows[0])
        } else {
          res.send('authentication required');
    });