Rails does not accept request

Asked

Viewed 67 times

0

I set up a simple API in Rails, it only reads the database, and returns the JSON according to the request.

However, I went to test the API, making a request with another device, connected via wireless, and could not get the JSON as a response. I looked up the bug on the Internet, and it looks like it’s something to do with protect_from_forgery, But even though I mentioned it, I couldn’t. So the API doesn’t have much to do with security, for example, requiring tokens and things like that, because I’m a beginner, and I don’t really know how to develop this part.

Follow the github link to the project: https://github.com/ViniciusVenancio/fatec-api

2 answers

0

  • So, I make a request on another machine, my API, localhost, and I can’t. It says that the rejected connection or timeout exceeded.

  • And it also seems that it would be something related to the token, because the request does not send tokens

  • But your application works on localhost without token?

  • Yes, normal. It’s just that, I create a ruby file, I make the request, because actually, I’m going to use this API, to return data to mobile devices, so I don’t get answers

0

Do the following

Edit as below /controllers/Applications protect_from_forgery with: :null_session

Browser other questions tagged

You are not signed in. Login or sign up in order to post.