Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

응답 테스트 및 핸들러 인자 사용처 확인 #7

Closed
argon1025 opened this issue Mar 15, 2021 · 2 comments
Closed

응답 테스트 및 핸들러 인자 사용처 확인 #7

argon1025 opened this issue Mar 15, 2021 · 2 comments
Assignees
Labels
enhancement🛠기능추가 New feature or request

Comments

@argon1025
Copy link
Owner

argon1025 commented Mar 15, 2021

No description provided.

@argon1025 argon1025 added the enhancement🛠기능추가 New feature or request label Mar 15, 2021
@argon1025 argon1025 self-assigned this Mar 15, 2021
@argon1025 argon1025 added this to To do in 최소 사양 구현 via automation Mar 15, 2021
@argon1025 argon1025 moved this from To do to In progress in 최소 사양 구현 Mar 15, 2021
@argon1025
Copy link
Owner Author

'use strict';

module.exports.hello = (event, context, callback) => {
  const response = {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Go Serverless v1.0! Your function executed successfully!',
      input: event,
    }),
  };

  callback(null, response);

  // Use this code if you don't use the http event with the LAMBDA-PROXY integration
  // callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event });
};

런타임은 3개의 인수를 핸들러 메서드에 전달합니다. 첫 번째 인수는 호출자로부터의 정보가 포함된 event 객체입니다. 이 정보는 Invoke를 호출할 때 호출자가 JSON 형식 문자열로 전달하고, 런타임은 이 정보를 객체로 변환합니다. AWS 서비스가 함수를 호출할 때, 이벤트 구조는 서비스별로 상이합니다.

두 번째 인수는 컨텍스트 객체이며, 여기에는 호출, 함수 및 실행 환경에 대한 정보가 포함되어 있습니다. 이전 예제에서는, 함수가 컨텍스트 객체로부터 로그 스트림의 이름을 가져와서 호출자에게 반환합니다.

세 번째 인수 callback은 응답을 전송하기 위해 비동기 이외의 핸들러에서 호출할 수 있는 함수입니다. 콜백 함수는 두 개의 인수, Error 및 응답을 사용합니다. 호출하면 Lambda는 이벤트 루프가 비워질 때까지 기다린 다음 응답이나 오류를 호출자에게 반환합니다. 응답 객체는 JSON.stringify와 호환되어야 합니다.

AWS 공식문서 참고는 여기

@argon1025 argon1025 changed the title 응답 테스트 및 오류처리 모듈 작성 응답 테스트 및 핸들러 인자 사용처 확인 Mar 16, 2021
@argon1025 argon1025 moved this from In progress to Done in 최소 사양 구현 Mar 18, 2021
@argon1025
Copy link
Owner Author

#9 에서 응답인자 테스트와 응답처리 모듈을 작성했습니다.
이슈를 닫습니다

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement🛠기능추가 New feature or request
Projects
Development

No branches or pull requests

1 participant