- invoke.go: forward sub-path and query string to function pods - server.js v0.1.2: add _path, _query, _method to event - server.py v0.1.1: add _path, _query, _method to event - upload.go: bump runtime versions (nodejs20:v0.1.2, python3.11:v0.1.1) - examples/notes-python: CRUD notes via sub-path routing - sql-runner: generic SQL executor for DDL jobs - notes: CRUD router (/add, /update, /delete) - notes-list: SELECT all notes - init.tf: create TABLE + INDEX on apply
33 lines
977 B
HCL
33 lines
977 B
HCL
# 2025-06-05
|
|
# notes-list.tf — функция для получения всех записей из таблицы notes.
|
|
# GET или POST /fn/default/notes-list → JSON массив всех записей, сортировка по дате (новые первые).
|
|
|
|
data "archive_file" "notes_list" {
|
|
type = "zip"
|
|
source_dir = "${path.module}/code/notes-list"
|
|
output_path = "${path.module}/dist/notes-list.zip"
|
|
}
|
|
|
|
resource "sless_function" "notes_list" {
|
|
namespace = "default"
|
|
name = "notes-list"
|
|
runtime = "python3.11"
|
|
entrypoint = "handler.handle"
|
|
memory_mb = 128
|
|
timeout_sec = 30
|
|
|
|
env_vars = {
|
|
PG_DSN = var.pg_dsn
|
|
}
|
|
|
|
code_path = data.archive_file.notes_list.output_path
|
|
code_hash = filesha256("${path.module}/code/notes-list/handler.py")
|
|
}
|
|
|
|
resource "sless_trigger" "notes_list_http" {
|
|
namespace = "default"
|
|
name = "notes-list-http"
|
|
type = "http"
|
|
function = sless_function.notes_list.name
|
|
}
|