Skip to content

Commit

Permalink
Moved --api comment in README
Browse files Browse the repository at this point in the history
  • Loading branch information
cyu committed Sep 11, 2022
1 parent 36e2378 commit f96f392
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ gem 'rack-cors'
### Rails Configuration
For Rails, you'll need to add this middleware on application startup. A practical way to do this is with an initializer file. For example, the following will allow GET, POST, PATCH, or PUT requests from any origin on any resource:

NOTE: If you create application with `--api` option, configuration automatically generate in `config/initializers/cors.rb`.

```ruby
# config/initializers/cors.rb

Expand All @@ -35,6 +33,8 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do
end
```

NOTE: If you create application with `--api` option, configuration automatically generate in `config/initializers/cors.rb`.

We use `insert_before` to make sure `Rack::Cors` runs at the beginning of the stack to make sure it isn't interfered with by other middleware (see `Rack::Cache` note in **Common Gotchas** section). Basic setup examples for Rails 5 & Rails 6 can be found in the examples/ directory.

See The [Rails Guide to Rack](http://guides.rubyonrails.org/rails_on_rack.html) for more details on rack middlewares or watch the [railscast](http://railscasts.com/episodes/151-rack-middleware).
Expand Down

0 comments on commit f96f392

Please sign in to comment.