API Flashcards

1
Q

How to create API only rails app?

A

rails new api_sample –api

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly