You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
446 B
18 lines
446 B
const pool = require("../db");
|
|
const authorization = require("../middlewares/authorization");
|
|
|
|
const router = require("express").Router();
|
|
|
|
router.get("/", authorization, async (req, res) => {
|
|
try {
|
|
const user = await pool.query(
|
|
"SELECT user_name FROM users WHERE user_id = $1",
|
|
[req.user]
|
|
);
|
|
res.json(user.rows[0]);
|
|
} catch (error) {
|
|
return res.status(500).json("Server Error");
|
|
}
|
|
});
|
|
module.exports = router;
|