UNPKG

solana-framework-deno

Version:

solana-framework-deno is solana uni-tools for deno

28 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseRequest = exports.response = void 0; exports.response = { info: (info) => { return new Response(JSON.stringify({ info }), { headers: { "Content-Type": "application/json" }, status: 200 }); }, data: (data) => { return new Response(JSON.stringify(data), { headers: { "Content-Type": "application/json" }, status: 200 }); }, error: (error) => { return new Response(JSON.stringify({ error }), { headers: { "Content-Type": "application/json" }, status: 500 }); } }; async function parseRequest(req, supabase) { const authHeader = req.headers.get('Authorization'); const token = authHeader.replace('Bearer ', ''); const { data } = await supabase.auth.getUser(token); const user = data.user; try { const body = await req.json(); return { user, body }; } catch { } return { user }; } exports.parseRequest = parseRequest; //# sourceMappingURL=supabase.js.map