examples/hello-node: two different functions (http greeting, job sum)
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
# 2026-03-08
|
||||
# http.tf — вариант с HTTP-триггером: постоянный эндпоинт, обрабатывает запросы.
|
||||
# http.tf — HTTP-функция: принимает запросы, возвращает приветствие.
|
||||
# Код: code/handler-http.js
|
||||
#
|
||||
# Использование:
|
||||
# terraform apply
|
||||
# curl -s -X POST $(terraform output -raw trigger_url) \
|
||||
# -H 'Content-Type: application/json' -d '{"name":"Naeel"}'
|
||||
|
||||
data "archive_file" "handler_http" {
|
||||
type = "zip"
|
||||
source_file = "${path.module}/code/handler-http.js"
|
||||
output_path = "${path.module}/handler-http.zip"
|
||||
}
|
||||
|
||||
resource "sless_function" "hello_http" {
|
||||
namespace = "default"
|
||||
name = "hello-http"
|
||||
runtime = "nodejs20"
|
||||
entrypoint = "handler.handle"
|
||||
entrypoint = "handler-http.handle"
|
||||
memory_mb = 128
|
||||
timeout_sec = 30
|
||||
|
||||
code_path = data.archive_file.handler.output_path
|
||||
code_hash = data.archive_file.handler.output_md5
|
||||
code_path = data.archive_file.handler_http.output_path
|
||||
code_hash = data.archive_file.handler_http.output_md5
|
||||
}
|
||||
|
||||
resource "sless_trigger" "hello_http" {
|
||||
|
||||
Reference in New Issue
Block a user