main
alex 2024-01-14 15:20:58 +01:00
parent ef057b7a88
commit e49331ac67
1 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import express, { Express } from "express";
import express, { Express, Request } from "express";
import dotenv from "dotenv";
import bodyParser from "body-parser";
import swaggerUI from "swagger-ui-express";
@ -80,6 +80,24 @@ passport.use(
)
);
interface User {
id: string;
username: string;
name: string;
}
passport.serializeUser(function (user, cb) {
process.nextTick(function () {
cb(null, { id: user.id, username: user.username, name: user.name });
});
});
passport.deserializeUser(function (user: User, cb) {
process.nextTick(function () {
return cb(null, user);
});
});
// TODO: setup cors
app.use(cors());