FIX - Backend for deployment

This commit is contained in:
Manik Maity
2024-11-13 20:06:54 +05:30
parent b394bbbd07
commit 84387d4f54
3 changed files with 15 additions and 8 deletions

View File

@@ -5,7 +5,8 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"dev": "node --watch ./src/index.js" "dev": "node --watch ./src/index.js",
"start": "node ./src/index.js"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@@ -31,7 +31,9 @@ export async function signinController(req, res) {
const { token, userData } = await signinService(email, password); const { token, userData } = await signinService(email, password);
res.cookie("livepoll-access-token", token, { res.cookie("livepoll-access-token", token, {
httpOnly: true, httpOnly: true,
maxAge: 10 * 24 * 60 * 60 * 1000, // 10 days secure: true,
sameSite: "None",
path: "/"
}).status(200).json({ }).status(200).json({
success : true, success : true,
message : "User signedin successfully.", message : "User signedin successfully.",

View File

@@ -20,18 +20,22 @@ app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs));
const io = new Server(httpServer, { const io = new Server(httpServer, {
cors: { cors: {
origin: CLIENT_URL, origin: CLIENT_URL,
methods: ["GET", "POST", "PUT", "DELETE"] methods: ["GET", "POST", "PUT", "DELETE"],
credentials: true
} }
}) })
handlePollSocket(io); handlePollSocket(io);
app.use(cookieParser()); app.use(cookieParser());
app.use(cors({ app.use(cors(
origin: CLIENT_URL, {
credentials: true origin: CLIENT_URL,
})) credentials: true,
}
))
app.use(express.json()) app.use(express.json())
app.get("/ping", (_req, res) => { app.get("/ping", (_req, res) => {
res.json({ message: "pong" }) res.json({ message: "pong" })