API Flashcards
1
Q
How to create API only rails app?
A
rails new api_sample –api
2
Q
How to send a post request with a body via POSTMAN?
A
# Body -> raw -> json { "cat": { "name": "Nic" } }
# controller params[:cat][:name] # Nic
3
Q
What is CORS? And how to disable it?
A
CORS refers to ‘Cross origin resource sharing’ and it is essentially how the server filters out requests from an origin other than itself. ( You can set who can get access to your API ( url and request )
You can set up it using Rack-Cors gem.