FIX - Backend for deployment
This commit is contained in:
@@ -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": "",
|
||||||
|
|||||||
@@ -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.",
|
||||||
|
|||||||
@@ -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" })
|
||||||
|
|||||||
Reference in New Issue
Block a user