티스토리 뷰
참고한 가이드 : guides.rubyonrails.org/api_app.html
rails new my_api --api
- Configure your application to start with a more limited set of middleware than normal. Specifically, it will not include any middleware primarily useful for browser applications (like cookies support) by default.
- Make ApplicationController inherit from ActionController::API instead of ActionController::Base. As with middleware, this will leave out any Action Controller modules that provide functionalities primarily used by browser applications.
- Configure the generators to skip generating views, helpers, and assets when you generate a new resource.
** 만약 원래 있던 프로젝트에서 API-only application으로 바꾸고 싶다면, 가이드 3.2번을 참고하자.
[미들웨어 고르기]
미들웨어가 뭔지 궁금하다면 =>velog.io/@hyob/Rack-Middleware
간단히 말하면 플랫폼들 사이를 연결시켜주는 프로그램 같은거다.
이런 미들웨어를 API API-only application 에서는 지원한다.
ActionDispatch::HostAuthorization
Rack::Sendfile
ActionDispatch::Static
ActionDispatch::Executor
ActiveSupport::Cache::Strategy::LocalCache::Middleware
Rack::Runtime
ActionDispatch::RequestId
ActionDispatch::RemoteIp
Rails::Rack::Logger
ActionDispatch::ShowExceptions
ActionDispatch::DebugExceptions
ActionDispatch::ActionableExceptions
ActionDispatch::Reloader
ActionDispatch::Callbacks
ActiveRecord::Migration::CheckPending
Rack::Head
Rack::ConditionalGet
Rack::ETag
이 명령어로 확인 가능하다.
bin/rails middleware
'Web > RubyOnRails' 카테고리의 다른 글
[RubyOnRails] RubyMine으로 DB 보기 (0) | 2021.02.08 |
---|---|
[RubyOnRails] 루비 문법 정리 (0) | 2021.02.08 |
rails console http run (0) | 2019.11.21 |