Skip to content

Commit

Permalink
fix: make secure dependent on __prod__
Browse files Browse the repository at this point in the history
  • Loading branch information
thenicekat committed Feb 26, 2024
1 parent fb1842e commit 9b1b44b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dotenv/config'
import express, { Express } from 'express'
import session from 'express-session'
const cors = require('cors');
import { PORT, SESSIONKEY } from './constants'
import { PORT, SESSIONKEY, __prod__ } from './constants'
// Middleware
import { loggerMiddleware } from './middleware/logger.middleware'
import { errorsMiddleware } from './middleware/error.middleware'
Expand Down Expand Up @@ -37,7 +37,7 @@ app.use(session({
resave: false,
saveUninitialized: true,
cookie: {
secure: true,
secure: __prod__,
maxAge: 1000 * 60 * 60 * 24 * 1 // 1 day
},
}))
Expand Down
4 changes: 2 additions & 2 deletions backend/src/routes/user.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ userRouter.post("/signup", async (req, res) => {
const userEmail = req.session.email as string;

data["email"] = userEmail;
console.log(data)

const createUser = await newUser(data);

if (createUser.error) {
Expand All @@ -27,7 +27,7 @@ userRouter.post("/signup", async (req, res) => {
message: "User created successfully",
data: createUser.data
}
res.redirect('/');

return res.status(HttpCodes.CREATED).json(response);
});

0 comments on commit 9b1b44b

Please sign in to comment.