- mysql
- aws-sdk
- winston
- winston-daily-rotate-file
- jsonwebtoken
- google-auth-library
- source/app.js
- app.use('/', indexRouter)
- source/routes/index.js
- const login = require('./login/index')
- source/routes/login/index.js
- const controller = require('./login.controller')
- router.post('/auth', controller.main)
- source/routes/login/login.controller.js
- const dao = require('./login.dao')
- const auth_config_dev = require('/source/config/auth_config_dev.js');
exports.main = (req, res, next) => { const result = await dao.selectToken(payload); }
- source/routes/login/login.dao.js
- const db_config_dev = require('/source/config/db_config_dev.js')
- const conn = db_config_dev.init()
db_config_dev.connect(conn); module.exports = { selectToken : function(payload){ var sql = 'SELECT token FROM user WHERE GOOGLE_ID = ?'; var params = [payload.sub]; try { return new Promise(function(resolve, reject){ conn.query(sql, params, function(err,rows){ if(err) reject(err); resolve(rows); }); }); } } }