multy-stub/server/routers/old/easy-project/users.js
Primakov Alexandr Alexandrovich 4b0d9b4dbc mongoose + tests
2024-10-16 11:06:23 +03:00

22 lines
590 B
JavaScript

const router = require('express').Router()
const { expressjwt: jwt } = require('express-jwt')
const ObjectId = require('mongodb').ObjectID
const { JWT_SECRET } = require('./constants')
const { requiredFields, responseWrapper } = require('./utils')
const { getAllUsers } = require('./db')
router.get('/healthcheck', (req, res) => {
res.send(true)
})
router.get('/getForSelect', jwt({
secret: JWT_SECRET, algorithms: ['HS256'],
}), async (req, res, next) => {
const userList = await getAllUsers()
res.send(responseWrapper(undefined, userList))
})
module.exports = router