feat: add profiles session API
This commit is contained in:
12
dist/main.js
vendored
12
dist/main.js
vendored
@@ -2,9 +2,21 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@nestjs/core");
|
||||
const common_1 = require("@nestjs/common");
|
||||
const session = require("express-session");
|
||||
const app_module_1 = require("./app.module");
|
||||
async function bootstrap() {
|
||||
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
||||
app.use(session({
|
||||
secret: process.env.SESSION_SECRET || 'change-me',
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
cookie: {
|
||||
httpOnly: true,
|
||||
sameSite: process.env.SESSION_SAME_SITE ?? 'lax',
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
maxAge: Number(process.env.SESSION_MAX_AGE ?? 1000 * 60 * 60 * 24 * 7),
|
||||
},
|
||||
}));
|
||||
const allowedOrigins = process.env.CORS_ORIGIN
|
||||
? process.env.CORS_ORIGIN.split(',').map(origin => origin.trim())
|
||||
: ['http://localhost:3001'];
|
||||
|
||||
Reference in New Issue
Block a user