Simple application to create Serverless CRUD APIs using Jets framework of Ruby.
This is a simple serverless application build over Jets framework of the ruby. The application illustrates how we can create Serverless CRUD APIs using Jets framework.
To install ruby(2.5.1) in your machine, run following command
$ rvm install ruby-2.5.1
$ sudo apt install awscli
$ aws configure
$ git clone https://github.com/SystangoTechnologies/serverless-ruby-simple-crud.git
$ cd serverless-ruby-simple-crud
$ bundle install
$ jets db:create db:migrate db:seed
To start your the jets server locally, you need to run
$ jets s
Your Service must be running on http://localhost:8888
You can access the all the posts created using seed file on http://localhost:8888/posts
Before we deploy, we need to create a database that AWS Lambda will have access to.
We’ll also have to create and migrate the RDS database.
$ vim .env.development.remote # configure a remote RDS DB
$ JETS_ENV_REMOTE=1 jets db:create db:migrate
Once that is completed, let’s deploy our application to AWS Lambda.
$ jets deploy
Once the application is deployed you will get the API endpoint using which you can access APIs.
Once API gateway is created, you must setup Usage plan along with their API Keys form API gateway console. For this, you can follow the official doc for the same given by AWS.
If you want a custom authorization instead of this, just comment out the before_filter:authorize line in application.rb to make custom authorization work.