Initial commit
This commit is contained in:
23
backend/src/Express/Routes/DashboardRoute.js
Normal file
23
backend/src/Express/Routes/DashboardRoute.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const express = require("express");
|
||||
const User = require("../../Database/UserManager/User");
|
||||
const DataBaseManager = require("../../Database/DataBaseManager");
|
||||
|
||||
class DashboardRoute{
|
||||
/**@param {DataBaseManager} dbManager*/
|
||||
constructor(dbManager){
|
||||
this.router = express.Router();
|
||||
|
||||
this.db = dbManager;
|
||||
|
||||
this.router.get("/", async (req, res) => await this.userInfo(req, res))
|
||||
}
|
||||
|
||||
/**@param {express.Request} req @param {express.Response}*/
|
||||
async userInfo(req, res){
|
||||
const user = await this.db.usermanager.getUser({id: req.session.user.id});
|
||||
|
||||
res.json(user.toUserJSON());
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DashboardRoute;
|
||||
Reference in New Issue
Block a user