mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-21 17:12:33 +08:00
28 lines
972 B
TypeScript
28 lines
972 B
TypeScript
// Follow this setup guide to integrate the Deno language server with your editor:
|
|
// https://deno.land/manual/getting_started/setup_your_environment
|
|
// This enables autocomplete, go to definition, etc.
|
|
|
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
|
|
|
|
console.log("Hello from Functions!")
|
|
|
|
serve(async (req) => {
|
|
const socket = await Deno.connect({
|
|
port: 443,
|
|
hostname: 'google.com',
|
|
})
|
|
console.log(socket);
|
|
return new Response(
|
|
JSON.stringify( {
|
|
message: `Hello from Functions!`,
|
|
}),
|
|
{ headers: { "Content-Type": "application/json" } },
|
|
)
|
|
})
|
|
|
|
// To invoke:
|
|
// curl -i --location --request POST 'http://localhost:54321/functions/v1/' \
|
|
// --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
|
|
// --header 'Content-Type: application/json' \
|
|
// --data '{"name":"Functions"}'
|