Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ apps/alerting-engine/tmp/
# UI Registry build output
apps/web/public/r
packages/ui/public/r
# For vibing
research.md
plan.md
10 changes: 9 additions & 1 deletion apps/docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,21 @@ export default defineConfig({
slug: "reference/cli-reference",
},
{
label: "API Reference",
label: "API Reference V1 - Deprecated",
link: "https://api.openstatus.dev/v1",
// badge: { text: 'External' },
attrs: {
target: "_blank",
},
},
{
label: "API Reference V2",
link: "https://api.openstatus.dev/openapi",
// badge: { text: 'External' },
attrs: {
target: "_blank",
},
},
{
label: "DNS Monitor",
slug: "reference/dns-monitor",
Expand Down
39 changes: 39 additions & 0 deletions apps/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import { showRoutes } from "hono/dev";

import { resourceFromAttributes } from "@opentelemetry/resources";
import { ATTR_DEPLOYMENT_ENVIRONMENT_NAME } from "@opentelemetry/semantic-conventions/incubating";
import { Scalar } from "@scalar/hono-api-reference";
import { prettyJSON } from "hono/pretty-json";
import { requestId } from "hono/request-id";
import openapiV1Json from "../static/openapi-v1.json" with { type: "json" };
import openapiYaml from "../static/openapi.yaml" with { type: "text" };
import { env } from "./env";
import { handleError } from "./libs/errors";
import { publicRoute } from "./routes/public";
Expand Down Expand Up @@ -173,6 +176,7 @@ app.onError(handleError);
/**
* ConnectRPC Routes API v2 ftw
*/

mountRpcRoutes(app);

/**
Expand All @@ -190,6 +194,41 @@ app.get("/ping", (c) => {
);
});

app.get("/openapi.yaml", (c) => {
return c.text(openapiYaml, 200, { "Content-Type": "application/yaml" });
});
app.get("/openapi-v1.json", (c) => {
return c.text(JSON.stringify(openapiV1Json), 200, {
"Content-Type": "application/json",
});
});

app.get(
"/openapi",
Scalar({
url: "/openapi.yaml",
servers: [
{
url: "https://api.openstatus.dev/",
description: "Production server",
},
{
url: "http://localhost:3000/",
description: "Dev server",
},
],
metaData: {
title: "OpenStatus API",
description: "Start building with OpenStatus API",
ogDescription: "API Reference",
ogTitle: "OpenStatus API",
ogImage:
"https://openstatus.dev/api/og?title=OpenStatus%20API&description=API%20Reference",
twitterCard: "summary_large_image",
},
}),
);

/**
* API Routes v1
*/
Expand Down
5 changes: 2 additions & 3 deletions apps/server/src/routes/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ api.doc("/openapi", {
email: "[email protected]",
url: "https://www.openstatus.dev",
},
description:
"OpenStatus is a open-source synthetic monitoring tool that allows you to monitor your website and API's uptime, latency, and more. \n\n The OpenStatus API allows you to interact with the OpenStatus platform programmatically. \n\n To get started you need to create an account on https://www.openstatus.dev/ and create an api token in your settings.",
description: "This version is deprecated please use v2",
},
tags: [
{
Expand Down Expand Up @@ -108,7 +107,7 @@ api.doc("/openapi", {
api.get(
"/",
Scalar({
url: "/v1/openapi",
url: "/openapi-v1.json",
servers: [
{
url: "https://api.openstatus.dev/v1",
Expand Down
Loading
Loading