-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (27 loc) · 910 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const express = require("express");
const server = express();
const path = require("path");
const configurationPath = path.join(__dirname, "config.yaml");
const KumuluzeeDiscovery = require("@kumuluz/kumuluzee-discovery").default;
const configurationUtil = require("@kumuluz/kumuluzee-config").ConfigurationUtil;
let util = null;
const register = async() => {
await configurationUtil.initialize({
extension: "etcd",
configPath: configurationPath
});
util = configurationUtil;
await KumuluzeeDiscovery.initialize({extension: "etcd"});
KumuluzeeDiscovery.registerService();
};
register();
server.get("/lookup", async (req, res) => {
const response = await KumuluzeeDiscovery.discoverService({
value: "test-service",
version: "1.0.0",
environment: "dev",
accessType: "DIRECT"
});
res.json({service: response});
});
server.listen(3000, () => console.log("server running on port 3000!"));