check card details
This commit is contained in:
1 parent
9f32eb6362
commit
92fd405395
8 files changed
+307
-197
No files matched your search
+26
-4
@@ -179,10 +179,14 @@
|
||||
}
|
||||
},
|
||||
"/auth/logout": { "post": { "responses": { "200": { "description": "Logged out" } } } },
|
||||
"/auth/me": { "get": { "responses": { "200": { "description": "Current user" } } } },
|
||||
"/auth/cleanup": { "post": { "responses": { "200": { "description": "Cleanup executed" } } } },
|
||||
"/auth/cleanup-monitors": { "post": { "responses": { "200": { "description": "Monitor cleanup executed" } } } },
|
||||
|
||||
"/billing/plans": { "get": { "responses": { "200": { "description": "Available plans" } } } },
|
||||
"/billing/subscribe": { "post": { "responses": { "200": { "description": "Subscribed" } } } },
|
||||
"/billing/cancel": { "post": { "responses": { "200": { "description": "Canceled" } } } },
|
||||
"/billing/confirm": { "get": { "responses": { "200": { "description": "Subscription confirmed" } } } },
|
||||
|
||||
"/monitors": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
@@ -282,6 +286,9 @@
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/diagnostic/logs": { "get": { "responses": { "200": { "description": "Logs" } } } },
|
||||
"/diagnostic/jobs": { "get": { "responses": { "200": { "description": "Jobs" } } } },
|
||||
"/diagnostic/env": { "get": { "responses": { "200": { "description": "Environment" } } } },
|
||||
|
||||
"/checks": {
|
||||
"get": {
|
||||
@@ -295,6 +302,14 @@
|
||||
"responses": { "200": { "description": "Checks list" } }
|
||||
}
|
||||
},
|
||||
"/checks/{id}": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }
|
||||
],
|
||||
"responses": { "200": { "description": "Check by id" }, "404": { "description": "Not found" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/incidents": {
|
||||
"get": {
|
||||
@@ -310,10 +325,11 @@
|
||||
"/incidents/{id}/resolve": {
|
||||
"patch": {
|
||||
"parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } },
|
||||
"responses": { "200": { "description": "Resolved" } }
|
||||
}
|
||||
},
|
||||
"/incidents/export": { "get": { "responses": { "200": { "description": "Export incidents" } } } },
|
||||
"/incidents/{id}": { "get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Incident" } } } },
|
||||
|
||||
"/invite": {
|
||||
"get": { "responses": { "200": { "description": "Invites list" } } },
|
||||
@@ -399,9 +415,15 @@
|
||||
"post": { "responses": { "200": { "description": "Created" } } }
|
||||
},
|
||||
"/team-members/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Member" } } },
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Team member" } } },
|
||||
"patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Updated" } } },
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
}
|
||||
},
|
||||
|
||||
"/me": { "get": { "responses": { "200": { "description": "Current user" } } } },
|
||||
"/me/entitlements": { "get": { "responses": { "200": { "description": "Entitlements" } } } },
|
||||
"/me/permissions": { "get": { "responses": { "200": { "description": "Permissions" } } } },
|
||||
|
||||
"/stripe/webhook": { "post": { "responses": { "200": { "description": "Webhook received" } } } }
|
||||
}
|
||||
}
|
||||
+22
-7
@@ -12,6 +12,7 @@ const indexLogger = getChildLogger("index");
|
||||
import swaggerUi from "swagger-ui-express";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const createApp = async () => {
|
||||
await connectDatabase();
|
||||
@@ -38,13 +39,28 @@ const createApp = async () => {
|
||||
const routes = initRoutes(controllers, app);
|
||||
// expose services for route-level access (e.g., in me routes)
|
||||
app.set("services", services);
|
||||
// Swagger UI at /api-docs
|
||||
|
||||
try {
|
||||
// Load OpenAPI doc from project root within server folder
|
||||
const openapiPath = path.resolve(process.cwd(), "openapi.json");
|
||||
const openapiJson = JSON.parse(fs.readFileSync(openapiPath, "utf-8"));
|
||||
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(openapiJson));
|
||||
indexLogger.info("Swagger UI available at /api-docs");
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const candidates = [
|
||||
path.resolve(process.cwd(), "openapi.json"),
|
||||
path.resolve(process.cwd(), "server/openapi.json"),
|
||||
path.resolve(__dirname, "../openapi.json"),
|
||||
];
|
||||
const existing = candidates.find((p) => fs.existsSync(p));
|
||||
if (!existing) {
|
||||
indexLogger.error(
|
||||
"OpenAPI file not found. Checked: " + candidates.join(", ")
|
||||
);
|
||||
} else {
|
||||
const openapiJson = JSON.parse(fs.readFileSync(existing, "utf-8"));
|
||||
const setup = swaggerUi.setup(openapiJson);
|
||||
app.use("/api-docs", swaggerUi.serve, setup);
|
||||
|
||||
indexLogger.info(
|
||||
`Swagger UI available at /api-docs and /api/v1/api-docs (spec: ${existing})`
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
indexLogger.error("Failed to load OpenAPI document for Swagger UI", e);
|
||||
}
|
||||
@@ -53,7 +69,6 @@ const createApp = async () => {
|
||||
status: "OK",
|
||||
});
|
||||
});
|
||||
|
||||
const port = 52345;
|
||||
app.listen(port, "0.0.0.0", () => {
|
||||
indexLogger.info(`Server is running on http://localhost:${port}`);
|
||||
|
||||
Reference in new issue
Block a user