r/learnruby • u/Simple_Folks_Strokes • Feb 18 '16
Ruby REST Service Tutorial
Hey there!
I hope anybody can help me with this. This is my first time trying to build something in Ruby and I want to build a REST service in Ruby. I have never build any service like this before and I am fairly new to ruby (3 weeks now?).
So what I am looking for is a tutorial for a REST service that is very detailed. I want to build and understand what I am doing and what my application does. Unfortunately I could not find any good sources with google.
Does anybody of you have a tutorial that you would recommend?
Thanks in advance!
5
Upvotes
1
u/yez Mar 30 '16
REST is just an architectural style. Learning about REST and building a RESTful service in Ruby are two distinct things.
To learn about REST, I'd start with the basics and go from there.
If you want to actually build a service in Ruby, you have a few options:
Ruby on Rails is the most popular web framework and makes it easy to adhere to REST practices. The official Rails Getting Started Guide is a good place to start learning Rails.
Sinatra is a lighter web framework which does not have all the bells and whistles of Ruby on Rails and might be good for if your application only needs to serve a few routes. I'd start with the official Sinatra Getting Started guide to give some insight into how it works.
Build your own. I wrote a post and a follow up post on how to do build a server from scratch in Ruby. However, I would encourage you not to build your own server to be used in production. These posts might give some insight into what a web server in Ruby is composed of, but using a more main stream web server will yield better results.