-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
47 lines (40 loc) · 1.34 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import express from "express";
import swaggerJsdoc from "swagger-jsdoc";
import swaggerUi from "swagger-ui-express";
import { getBalanceRoute } from "./routes/balance.js";
import { getLogRoute } from "./routes/tezos_ednpoints.js";
import { getVerifiablePresentationRoute } from "./routes/federatedcatalogue.js";
import dotenv from "dotenv";
// set up express
const client = express();
client.use(express.json());
const port = 3000;
dotenv.config();
// Load speficig endspoints
getBalanceRoute(client);
getLogRoute(client);
getVerifiablePresentationRoute(client);
// Swagger Setup
const swaggerDefinition = {
openapi: "3.0.0",
info: {
title: "Tezos Client for Contract Management",
version: "1.0.0",
description:
"Interface to forward Assets, Policies and Contracts from Eclipse Dataspace Connector to smart contract deployed on Tezos testnet.",
},
servers: [
{ url: "http://" + "localhost" + ":3000", description: "Dev Server" },
],
};
const options = {
swaggerDefinition,
// Paths to files containing OpenAPI definitions
apis: ["./routes/*.js"],
};
const swaggerSpec = swaggerJsdoc(options);
client.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));
client.listen(port, () => {
console.log(`API listening at http://localhost:${port}`);
console.log(`For API Documentation see http://localhost:${port}/docs`);
});