I’m trying to use Dreamfactory for my APIs so I don’t have to add every single CRUDS whenever I add a schema.
So far it doesn’t look like there’s a way to import an Open API spec (several other low-code platforms support this.)
And it looks like to use the server connect within the form, I have to create an API anyways.
I created an API for login and a POST wrapper. In the post API file, I’m just passing in the service name, and object name which points to a dreamfactory login service. (I created a test form and tested this service with it, so that’s not the problem):
When I call the post_df API from the login API, I’m getting a connection refused error:
{
“status”: “500”,
“code”: “ECONNREFUSED”,
“message”: “connect ECONNREFUSED 127.0.0.1:8100”,
“stack”: “Error: connect ECONNREFUSED 127.0.0.1:8100\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)”
}
There’s no security set on either of these endpoints. Any reason why you can’t call one API action from another?
Thanks for your thoughtful reply. It’s not a second database. I’m using Dreamfactory which is an open source API gateway and Database API as a Service. TLDR; I don’t want to create 4-5 services per database table. This platform does this for me for free. All I have to do is sprinkle in some business logic and my API is done.
I created a generic Dreamfactory API wrapper to call a POST request. This API works like a champ.
Then, I created a ‘Login’ API that passes into the Post request the payload needed to the generic POST request.
If I call the generic request passing in the login info, that API works.
If I call the login api and then call the generic request from the API, that gets the error.
It’s not a problem with the code. I added logic in the generic request to just return a 200 message and am still getting the error.
I found your problem, NodeJS isn’t running on 127.0.0.1:8100, it’s running on 127.0.0.1:3000
It’s important to realize Wappler’s NodeJS is running inside a (Docker) container and bound to port 3000, but Docker publishes this port to 8100 on your host system. Because NodeJS is running inside a container, it only sees the localhost of such container, not the localhost of your host system.
This can be verified on your Development’s target docker-compose.yml:
services:
web:
ports:
- '8100:3000'
P.S.: I’ve moved your topic from Server Side Components to Wappler General How To just because so you can mark a reply (mine probably) as the solution for your question/problem