init
This commit is contained in:
parent
d795e47c55
commit
5463a56ba2
|
|
@ -0,0 +1,13 @@
|
||||||
|
app = "nodejs-buildpack-func-sample"
|
||||||
|
region = "asia-south1"
|
||||||
|
handler = "index.handler"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
buildpack_builder = "paketobuildpacks/builder-jammy-base"
|
||||||
|
buildpacks = ["paketo-buildpacks/nodejs"]
|
||||||
|
ignorefile = ".gitignore"
|
||||||
|
[build.args]
|
||||||
|
foo = "bar"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
FOO = "BAR"
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Define the handler function
|
||||||
|
export const handler = async (event, context) => {
|
||||||
|
try {
|
||||||
|
// Prepare the response JSON
|
||||||
|
const responseJson = {
|
||||||
|
message: "Hello World",
|
||||||
|
};
|
||||||
|
// Set the response headers
|
||||||
|
context.setHeader("Content-Type", "application/json");
|
||||||
|
// Send the response JSON
|
||||||
|
context.end(JSON.stringify(responseJson));
|
||||||
|
} catch (error) {
|
||||||
|
// Handle errors
|
||||||
|
console.error(error);
|
||||||
|
// Send an error response if needed
|
||||||
|
context.statusCode = 500;
|
||||||
|
context.setHeader("Content-Type", "text/plain");
|
||||||
|
context.end("Internal Server Error");
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user