Answer the question
In order to leave comments, you need to log in
Why session is not saved in NESTJS?
import { NestFactory } from '@nestjs/core';
import * as session from 'express-session';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(
session({
secret: 'my-secret',
resave: true,
saveUninitialized: true,
}),
);
app.enableCors();
await app.listen(3001);
}
bootstrap();
session.user = user;
session.isAuth = true;
await session.save((err) => {
if (err) console.log(err);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question