Comments (2)
'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 공식문서 참고는 여기
from harmony-serverless-backend.
#9 에서 응답인자 테스트와 응답처리 모듈을 작성했습니다.
이슈를 닫습니다
from harmony-serverless-backend.
Related Issues (20)
- EndPoint
- Log 기록 모듈 작성
- kakao/authorize endpoint 기능 명세 작성 및 구현
- GET /api/v1/accounts/:accountID 구현
- PUT /api/v1/accounts/:accountID 구현
- DELETE /api/v1/accounts/:accountID 구현 HOT 1
- GET /api/v1/jobtags 구현
- 데이터베이스 구성 HOT 3
- Techstack EndPoint 작업
- Projects EndPoint 작업
- 1차 릴리즈 작업 HOT 1
- Project Member Endpoint 작업
- Project stateTags EndPoint 구현
- CORS error HOT 1
- sequelize 적용 및 테스트 HOT 1
- Endpoint 작성, 핸들러 연결
- kakao/account endpoint 기능 명세 작성 및 구현 HOT 1
- Kakao 정보에 대응되는 데이터베이스 수정 및 시퀄라이즈 최신화 HOT 2
- 오류 처리 모듈 작성 및 테스트
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harmony-serverless-backend.