Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
45
Frontend-Learner/node_modules/nitropack/dist/presets/aws-lambda/runtime/aws-lambda.mjs
generated
vendored
Normal file
45
Frontend-Learner/node_modules/nitropack/dist/presets/aws-lambda/runtime/aws-lambda.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import "#nitro-internal-pollyfills";
|
||||
import { useNitroApp } from "nitropack/runtime";
|
||||
import {
|
||||
normalizeCookieHeader,
|
||||
normalizeLambdaIncomingHeaders,
|
||||
normalizeLambdaOutgoingBody,
|
||||
normalizeLambdaOutgoingHeaders
|
||||
} from "nitropack/runtime/internal";
|
||||
import { withQuery } from "ufo";
|
||||
const nitroApp = useNitroApp();
|
||||
export async function handler(event, context) {
|
||||
const query = {
|
||||
...event.queryStringParameters,
|
||||
...event.multiValueQueryStringParameters
|
||||
};
|
||||
const url = withQuery(
|
||||
event.path || event.rawPath,
|
||||
query
|
||||
);
|
||||
const method = event.httpMethod || event.requestContext?.http?.method || "get";
|
||||
if ("cookies" in event && event.cookies) {
|
||||
event.headers.cookie = event.cookies.join(";");
|
||||
}
|
||||
const r = await nitroApp.localCall({
|
||||
event,
|
||||
url,
|
||||
context,
|
||||
headers: normalizeLambdaIncomingHeaders(event.headers),
|
||||
method,
|
||||
query,
|
||||
body: event.isBase64Encoded ? Buffer.from(event.body || "", "base64").toString("utf8") : event.body
|
||||
});
|
||||
const isApiGwV2 = "cookies" in event || "rawPath" in event;
|
||||
const awsBody = await normalizeLambdaOutgoingBody(r.body, r.headers);
|
||||
const cookies = normalizeCookieHeader(r.headers["set-cookie"]);
|
||||
return {
|
||||
...cookies.length > 0 && {
|
||||
...isApiGwV2 ? { cookies } : { multiValueHeaders: { "set-cookie": cookies } }
|
||||
},
|
||||
statusCode: r.status,
|
||||
headers: normalizeLambdaOutgoingHeaders(r.headers, true),
|
||||
body: awsBody.body,
|
||||
isBase64Encoded: awsBody.type === "binary"
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue