[TIL] 0111 Happy coding
Today I Learnt
0111 :
호주에 온지 3주, 새집에 이사온지 3일이 지났다.
1. lamda + API gate
API Gate + lamda function
https://www.youtube.com/watch?v=X5dM2rlOKfw&t=0s
Lamda function GET example
exports.handler = async (event) => {
// TODO implement
const items ={
1234:{
description: " skyler t-shirt",
color: "blue",
size: "M",
price: 100.00
},
5678:{
description: " skyler t-shirt2",
color: "blue2",
size: "M2",
price: 200.00
}
};
const itemID = event.pathParameters.itemID
const item= items[itemID]
if(!item){
return {statusCode: 404,
body: JSON.stringify({ message: `item not found for ID of ${itemID}` })
}
}
const response = {
statusCode: 200,
body: JSON.stringify(item),
};
return response;
};
LAamda function POST example
exports.handler = async (event) => {
// TODO implement
const body = JSON.parse(event.body);
console.log("this is your item:", body)
// if you have db you make connection and write the logic here
const response = {
statusCode: 201,
body: JSON.stringify({message: "Cart Created"}),
};
return response;
};
2. instagram API
3. zzz Project API
4. zzz Project db schema
AWS CLI 등록 :
AWS profile등록 ,
Setting up AWS credentials - AWS Serverless Application Model
Setting up AWS credentials The AWS SAM command line interface (CLI) requires you to set AWS credentials so that it can make calls to AWS services on your behalf. For example, the AWS SAM CLI makes calls to Amazon S3 and AWS CloudFormation. You might have a
docs.aws.amazon.com
그리고
export AWS_PROFILE = [profile_name]
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html
Named profiles for the AWS CLI - AWS Command Line Interface
If you specify a profile with --profile on an individual command, that overrides the setting specified in the environment variable for only that command.
docs.aws.amazon.com
'IT > TIL(Today I Learnt)' 카테고리의 다른 글
[TIL]0211 (4) | 2022.02.11 |
---|---|
[TIL] 0207 Life aint easy (1) | 2022.02.07 |
[TIL] 1229 항해4기 (2) | 2021.12.30 |
[TIL] 1228 Document DB (0) | 2021.12.28 |
[TIL] 1225 메리크리스마스 (0) | 2021.12.27 |