Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't reach Eve REST API

I'm using Eve to create a REST API for MongoDB. It's all working fine, except for the fact that I can't reach the API from any other computer (in the same network), or even a different URL (e.g.: if I set SERVER_NAME = 'localhost:29000', I will not be able to reach the API with 127.0.0.1 and vice versa).

I've been looking around for hours, and I can't seem to find an answer. I also tried other REST API's for MongoDB like Kule, and they seem to work just fine, but they don't have as many options as Eve has.

like image 423
Timon Avatar asked Jan 09 '14 22:01

Timon


1 Answers

Eve's SERVER_NAME seems to be based on the configuration variable by the same name from Flask: See "More on server name" below the table in the Flask Configuration docs. So it's really just for the name (hostname / subdomain handling) - the actual network interfaces it binds to therfore are probably determined by the server that runs the WSGI application.

If you're just doing the

app = Eve()
app.run()

from the quickstart example, try

app.run(host='0.0.0.0')

instead and leave the server name empty (SERVER_NAME = '').

I've never used Eve, but from what I understand about how it's built that should work

like image 133
Lukas Graf Avatar answered Sep 29 '22 14:09

Lukas Graf