/demo-rails-api

demo-rails-api

Primary LanguageRuby

README

Simle demo of Rails app in Rails API mode. It has a books scaffold.

Rails Setup

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.

Here's the relevant code:

Original Project Creation

The project was originally generated with these commands:

rails new my_api --api --database mysql
cd my_api
rails g scaffold Book title:string

Jets Afterburner

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!