Skip to content

Commit 36c28b3

Browse files
committed
refactor: improve code readability in server.ts by formatting comments and indentation
1 parent 5e4ee2e commit 36c28b3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apps/api/src/server.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import { rateLimitRequests } from './middlewares/rateLimit.middleware';
1616

1717
export const createServer = (): Express => {
1818
const app = express();
19+
20+
// Trust proxy (CRITICAL for Nginx reverse proxy)
21+
app.set('trust proxy', 1);
22+
1923
app
2024
.disable('x-powered-by')
2125
.use(morgan('dev'))
@@ -33,9 +37,12 @@ export const createServer = (): Express => {
3337
cookie: {
3438
secure: process.env.NODE_ENV === 'production',
3539
httpOnly: true,
36-
maxAge: 2 * 24 * 60 * 60 * 1000,
40+
maxAge: 2 * 24 * 60 * 60 * 1000, // 2 days
3741
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
38-
domain: process.env.NODE_ENV === 'production' ? process.env.COOKIE_DOMAIN : undefined,
42+
domain:
43+
process.env.NODE_ENV === 'production'
44+
? process.env.COOKIE_DOMAIN
45+
: undefined,
3946
},
4047
resave: false,
4148
saveUninitialized: false,

0 commit comments

Comments
 (0)