How to create API only rails app?
rails new api_sample –api
How to send a post request with a body via POSTMAN?
# Body -> raw -> json
{
"cat": {
"name": "Nic"
}
}
# controller params[:cat][:name] # Nic
What is CORS? And how to disable it?
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.