Hi! For some reason I keep getting a connection error.
Error: Error: getaddrinfo ENOTFOUND localhost:8080
at ClientRequest.<anonymous> (/home/user/Desktop/dtwin/twin/node_modules/@eclipse-ditto/ditto-javascript-client-node/dist/node/src/node-http.js:67:27)
at ClientRequest.emit (node:events:365:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:365:28)
at emitErrorNT (node:internal/streams/destroy:193:8)
at emitErrorCloseNT (node:internal/streams/destroy:158:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
import {
DittoNodeClient,
NodeHttpBasicAuth,
Thing,
} from "@eclipse-ditto/ditto-javascript-client-node";
const domain = "localhost:8080";
const username = "ditto";
const password = "ditto";
const client = DittoNodeClient.newHttpClient()
.withoutTls()
.withDomain(domain)
.withAuthProvider(NodeHttpBasicAuth.newInstance(username, password))
.build();
const thingsHandle = client.getThingsHandle();
const thing = new Thing("the:thing");
thingsHandle
.putThing(thing)
.then((result) =>
console.log(
`Finished putting thing with result: ${JSON.stringify(result)}`
)
);
curl -u devops:foobar http://localhost:8080/status/health
{"label":"roles","status":"UP","children":[{"label":"expected-roles","status":"UP","details":[{"INFO":{"missing-roles":[],"extra-roles":[]}}]},{"label":"concierge","status":"UP","children":[{"label":"172.20.0.5:2551","status":"UP","children":[{"label":"persistence","status":"UP"},{"label":"SingletonStatusReporter","status":"UP","details":[{"INFO":{"enabled":true,"events":[],"credit-decisions":[],"actions":[]}}]}]}]},{"label":"things","status":"UP","children":[{"label":"172.20.0.7:2551","status":"UP","children":[{"label":"persistence","status":"UP"},{"label":"MongoMetricsReporter","status":"UP","details":[{"INFO":{"reporter":"/user/thingsRoot/healthCheckingActor/MongoMetricsReporter","resolution":"PT5S","maxTimerNanos":[0,0,0,0,0]}}]}]}]},{"label":"connectivity","status":"UP","children":[{"label":"172.20.0.9:2551","status":"UP","children":[{"label":"persistence","status":"UP"}]}]},{"label":"policies","status":"UP","children":[{"label":"172.20.0.3:2551","status":"UP","children":[{"label":"persistence","status":"UP"}]}]},{"label":"things-search","status":"UP","children":[{"label":"172.20.0.6:2551","status":"UP","children":[{"label":"persistence","status":"UP"},{"label":"backgroundSync","status":"UP","details":[{"INFO":{"enabled":true,"events":[],"progressPersisted":":_","progressIndexed":":_"}}]}]}]},{"label":"gateway","status":"UP","children":[{"label":"172.20.0.8:2551","status":"UP"}]}]}