Another complete rework

This commit is contained in:
Gregory Campbell
2026-06-14 14:34:21 -04:00
parent 06739891e3
commit f4e42dfb02
495 changed files with 71 additions and 150349 deletions
-45
View File
@@ -1,45 +0,0 @@
package main
import (
"context"
"encoding/json"
"log"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
type Response struct {
StatusCode int `json:"statusCode"`
Headers map[string]string `json:"headers"`
Body string `json:"body"`
}
func handler(ctx context.Context, request events.APIGatewayProxyRequest) (Response, error) {
log.Printf("Received request: %+v", request)
headers := map[string]string{
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Content-Type": "application/json",
}
responseBody := map[string]interface{}{
"message": "Hello from reorganized Go Lambda!",
"path": request.Path,
"method": request.HTTPMethod,
}
body, _ := json.Marshal(responseBody)
return Response{
StatusCode: 200,
Headers: headers,
Body: string(body),
}, nil
}
func main() {
lambda.Start(handler)
}
@@ -1,5 +1,6 @@
module api-handler
module go-functions
go 1.21
require github.com/aws/aws-lambda-go v1.41.0
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"context"
"fmt"
"github.com/aws/aws-lambda-go/lambda"
)
type MyEvent struct {
Name string `json:"name"`
}
type MyResponse struct {
Message string `json:"message"`
}
func HandleRequest(ctx context.Context, event MyEvent) (MyResponse, error) {
return MyResponse{
Message: fmt.Sprintf("Hello %s from Go Lambda!", event.Name),
}, nil
}
func main() {
lambda.Start(HandleRequest)
}
-11
View File
@@ -1,11 +0,0 @@
package crud
import "github.com/gjcampbell777/personal_site/backend-go/internal/database"
func Health(db *database.Client) map[string]string {
return map[string]string{
"status": "ok",
"service": "portfolio-api",
"database": db.Status(),
}
}
-11
View File
@@ -1,11 +0,0 @@
package database
type Client struct{}
func NewClient() *Client {
return &Client{}
}
func (c *Client) Status() string {
return "ready"
}