Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails API
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Saurabh Bhatia
February 22, 2014
Technology
0
440
Rails API
API only applications with Rails API
Saurabh Bhatia
February 22, 2014
Tweet
Share
More Decks by Saurabh Bhatia
See All by Saurabh Bhatia
Barrister RPC
thewub
0
450
RulingOrbit
thewub
0
390
Symbols and Hashes Intro
thewub
0
59
Cloud Primer
thewub
1
410
Other Decks in Technology
See All in Technology
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
220
What happened to RubyGems and what can we learn?
mikemcquaid
0
250
Bill One急成長の舞台裏 開発組織が直面した失敗と教訓
sansantech
PRO
2
300
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
1.6k
IaaS/SaaS管理における SREの実践 - SRE Kaigi 2026
bbqallstars
4
1.7k
Digitization部 紹介資料
sansan33
PRO
1
6.8k
Stately
mu7889yoon
1
110
セキュリティについて学ぶ会 / 2026 01 25 Takamatsu WordPress Meetup
rocketmartue
1
290
Cosmos World Foundation Model Platform for Physical AI
takmin
0
340
入社1ヶ月でデータパイプライン講座を作った話
waiwai2111
1
250
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
680
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
170
Skip the Path - Find Your Career Trail
mkilby
0
53
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
55
Music & Morning Musume
bryan
47
7.1k
Thoughts on Productivity
jonyablonski
74
5k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Building AI with AI
inesmontani
PRO
1
680
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Rails Girls Zürich Keynote
gr2m
96
14k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
130
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Transcript
API Only Applications with rails-api Saurabh Bhatia http://fedible.org
what? $ gem install rails-api Rails minus some middleware stack,
actionpack modules and template generation.
why? • Lightweight • Fast • API only application –
backend for mobile app, web application is just another client (e.g. html, angular.js ) to a json api.
Generating a new app $ rails-api new notesapp
No views
rails-api controller app/controllers/application_controller.rb class ApplicationController < ActionController::API end
controller actions def index @posts = Post.all render json: @posts
end • rails-api uses render instead of respond methods. • Let's see how to include those.
extending controller class ApplicationController < ActionController::API include ActionController::MimeResponds include ActionController::ImplicitRender
end • MimeResponds and Implicit render provide support for respond_to, respond_with.
middleware
extending middleware $config/application.rb require File.expand_path('../boot', __FILE__) require 'rails/all'. Bundler.require(:default, Rails.env)
module Notesapp class Application < Rails::Application config.middleware.use ActionDispatch::Flash end end
extended
serializers • gem "active_model_serializers" • $rails g serialzer post •
$ ls assets controllers mailers models serializers app$ cd serializers/ app/serializers$ ls post_serializer.rb
serialzers class PostSerializer < ActiveModel::Serializer attributes :title, :body end •
JSON Response {"posts": [{"id":1,"title":"First Post","body":"Test"}, {"id":2,"title":"Second Post","body":"Another Test"}] }
Shameless Plug : Rails 4 application development
Thank you 謝謝