/
home
/
techb158
/
balavpn.abdallabala.com
/
src
/
app
/
api
/
auth
/
login
/
/home/techb158/balavpn.abdallabala.com/src/app/api/auth/login
mkdir
upload
Name
Size
Mode
Actions
route.js
773
0644
edit
dl
rm
Edit:
/home/techb158/balavpn.abdallabala.com/src/app/api/auth/login/route.js
(773B)
const { login } = require("../../../../services/auth-service"); const { jsonResponse, errorResponse, parseJson } = require("../../../../lib/http"); export async function POST(request) { try { const body = await parseJson(request); const { user, session } = await login(body); return new Response(JSON.stringify({ user: { id: user.id, email: user.email, displayName: user.displayName } }), { status: 200, headers: { "Content-Type": "application/json", "Set-Cookie": `cosmic_session=${session.token}; HttpOnly; ${process.env.NODE_ENV === 'production' ? 'Secure; ' : ''}SameSite=Lax; Path=/; Max-Age=${60 * 60 * 24 * 7}`, "Cache-Control": "no-store" } }); } catch (error) { return errorResponse(error); } }
Save
cmd:
run