summaryrefslogtreecommitdiffstats
path: root/backend/src/index.js
diff options
context:
space:
mode:
authorJohannes Schickling <schickling.j@gmail.com>2018-05-21 17:44:31 -0700
committerJohannes Schickling <schickling.j@gmail.com>2018-05-21 17:44:31 -0700
commitc5445348614486c95fc5f989ca2b19f00946824f (patch)
tree08ae3a32879c485450cdb74784715a9cf508cfb7 /backend/src/index.js
parent603f1a0e9df2f88184cc03ce2e7177547daa0674 (diff)
refactor db file
Diffstat (limited to 'backend/src/index.js')
-rw-r--r--backend/src/index.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/backend/src/index.js b/backend/src/index.js
index 86bba16..94911ec 100644
--- a/backend/src/index.js
+++ b/backend/src/index.js
@@ -3,6 +3,7 @@ require('dotenv').config({ path: 'variables.env' });
/* eslint-enable */
const jwt = require('jsonwebtoken');
const createServer = require('./createServer');
+const db = require('./db');
const cookieParser = require('cookie-parser');
const server = createServer();
@@ -21,9 +22,7 @@ server.express.use((req, res, next) => {
// 2. Get User from their ID
server.express.use(async (req, res, next) => {
if (!req.userId) return next();
- const user = await server
- .context()
- .db.query.user({ where: { id: req.userId } }, `{ id, permissions, email, name }`);
+ const user = await db.query.user({ where: { id: req.userId } }, `{ id, permissions, email, name }`);
req.user = user;
next();
});