diff options
| author | Johannes Schickling <schickling.j@gmail.com> | 2018-05-21 17:44:31 -0700 |
|---|---|---|
| committer | Johannes Schickling <schickling.j@gmail.com> | 2018-05-21 17:44:31 -0700 |
| commit | c5445348614486c95fc5f989ca2b19f00946824f (patch) | |
| tree | 08ae3a32879c485450cdb74784715a9cf508cfb7 /backend/src/index.js | |
| parent | 603f1a0e9df2f88184cc03ce2e7177547daa0674 (diff) | |
refactor db file
Diffstat (limited to 'backend/src/index.js')
| -rw-r--r-- | backend/src/index.js | 5 |
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(); }); |
