| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repository includes the following samples.
Simply copy a file corresponding to your API Gateway type to the root directory of your Ruby on Rails project.
You have two options to create Lambda function.
In this sample, we provide sample Dockerfile to build container image of Ruby on Rails.
Specify handler name as follows:
Specify environment variables as follows:
| Key | Example |
|---|---|
| BOOTSNAP_CACHE_DIR | /tmp/cache |
| RAILS_LOG_TO_STDOUT | 1 |
| RAILS_ENV | production |
| RAILS_MASTER_KEY | Value of your master.key |
| RAILS_RELATIVE_URL_ROOT | (Optional) Path prefix of your Rails application |
| ... | Other variables if needed |
Sample application provides simple Web APIs to query fixed database contains 'Hello World' message.
[
{
"id": 1,
"text": "Hello, World!",
"created_at" :"2022-12-15T01:31:59.291Z",
"updated_at": "2022-12-15T01:31:59.291Z",
"url": "URL OF THIS MESSAGE"
}
]
{
"id": 1,
"text": "Hello, World!",
"created_at" :"2022-12-15T01:31:59.291Z",
"updated_at": "2022-12-15T01:31:59.291Z",
"url": "URL OF THIS MESSAGE"
}
cd cdk npm ci npx cdk deploy -c railsMasterKey=d1c2ae419e40d2c43006aacdf98cf7f0
After waiting for completion, you will see the outputs like below:
RailsLambdaStack.HttpHttpApiUrlE6BB121E = https://xxxx.execute-api.ap-northeast-1.amazonaws.com/ RailsLambdaStack.RestRestApiUrl2AB183B3 = https://yyyy.execute-api.ap-northeast-1.amazonaws.com/default/
You can test these APIs by using HTTP client such as cURL.
curl https://xxxx.execute-api.ap-northeast-1.amazonaws.com/messages
[
{
"id": 1,
"text": "Hello, World!",
"created_at" :"2022-12-15T01:31:59.291Z",
"updated_at": "2022-12-15T01:31:59.291Z",
"url": "https://xxxx.execute-api.ap-northeast-1.amazonaws.com/messages/1"
}
]
curl https://yyyy.execute-api.ap-northeast-1.amazonaws.com/default/messages
[
{
"id": 1,
"text": "Hello, World!",
"created_at": "2022-12-15T01:31:59.291Z",
"updated_at": "2022-12-15T01:31:59.291Z",
"url": "https://yyyy.execute-api.ap-northeast-1.amazonaws.com/default/messages/1"
}
]
| Back | FazBrowse Home | New Git URL |