test
parent
ef057b7a88
commit
e49331ac67
20
server.ts
20
server.ts
|
@ -1,4 +1,4 @@
|
||||||
import express, { Express } from "express";
|
import express, { Express, Request } from "express";
|
||||||
import dotenv from "dotenv";
|
import dotenv from "dotenv";
|
||||||
import bodyParser from "body-parser";
|
import bodyParser from "body-parser";
|
||||||
import swaggerUI from "swagger-ui-express";
|
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
|
// TODO: setup cors
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue