Simle demo of Rails app in Rails API mode. It has a books scaffold.
git clone https://github.com/tongueroo/demo-rails-api
cd demo-rails-api
# edit config/database.yml with the desired database endpoint
bundle
rails db:create db:migrate
rails server # start server
Now you can should be able to go to the url endpoints to see the demo page.
- http://localhost:3000
- http://localhost:3000/books # demo CRUD with books
Here's the relevant code:
The project was originally generated with these commands:
rails new my_api --api --database mysql
cd my_api
rails g scaffold Book title:string
To deploy this Rails app to AWS Lambda you can use Jets Afterburner.
cd demo-rails
gem install jets # outside of Gemfile
mkdir -p .jets/app
vim .jets/app/.env # add your env variables
jets deploy
Here's the blog article that covers it: Jets Afterburner: Serverless Rails on AWS Lambda in 5 Minutes
Also here's the link to the Live Rails API Mode Demo
If you find Jets interesting, please it a GitHub star tongueroo/jets. It helps others find out about the project. I'd appreciate it!