Skip to content

Enhance Serverless Task Manager infrastructure and documentation - #1

Merged
tbnguyen274 merged 11 commits into
mainfrom
feat/iac-deploy
Jun 1, 2026
Merged

Enhance Serverless Task Manager infrastructure and documentation#1
tbnguyen274 merged 11 commits into
mainfrom
feat/iac-deploy

Conversation

@tbnguyen274

Copy link
Copy Markdown
Collaborator

This pull request refactors the backend task handler code to support both Express and AWS Lambda environments, enabling code reuse and consistent API responses across both. It introduces dual exports (handler for Express, lambdaHandler for Lambda) for each handler, adds shared utilities for Lambda response formatting and authentication parsing, and updates the code to maintain consistent response shapes and error handling. Documentation is also added to explain the migration strategy and template audit findings.

Backend Handler Refactoring for Dual Express/Lambda Support:

  • All handler files (createTask.js, getTasks.js, updateTask.js, deleteTask.js, updateTask.js) now export both handler (Express) and lambdaHandler (Lambda) functions. Lambda handlers parse API Gateway events, extract user info from Cognito claims, and return API Gateway-compatible responses, while Express handlers retain their original shape. [1] [2] [3] [4]
  • Shared Lambda helpers (jsonResponse, parseJsonBody, getUserId) are added in backend/src/shared/lambda.js to standardize response formatting and user authentication extraction for Lambda handlers.

Error Handling and Validation Consistency:

  • All handlers now consistently check for required parameters (e.g., userId, taskId) and return appropriate status codes and error messages for missing fields, permission issues, or server errors, matching Express and Lambda behaviors. [1] [2] [3]

Node.js and Dependency Updates:

  • The backend/package.json now specifies Node.js 24+ as the required engine to align with Lambda runtime requirements.

Documentation and Migration Planning:

  • New documentation files provide a detailed migration plan for handler refactoring (brainstorm-lambda-handlers-2026-05-31.md) and a template audit with recommendations for deployment and template fixes (brainstorm-template-audit-2026-05-31.md). [1] [2]

Minor/Other:

  • Minor fixes, such as proper export in authMiddleware.js and small cleanups in frontend/package-lock.json, are included. [1] [2]

These changes ensure the backend codebase is ready for AWS Lambda deployment without breaking local Express development, and that API behavior remains consistent across environments.

@tbnguyen274
tbnguyen274 requested review from Copilot and removed request for Copilot June 1, 2026 06:51
@tbnguyen274
tbnguyen274 merged commit 239248f into main Jun 1, 2026
1 check failed
@thang-ngquoc
thang-ngquoc deleted the feat/iac-deploy branch June 14, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant