build stuff

This commit is contained in:
2025-12-12 17:27:08 -06:00
parent 3e8ff8ef4c
commit c3b2acd033
7 changed files with 1257 additions and 23 deletions

View File

@@ -1,10 +1,34 @@
import { apiReference } from "@scalar/express-api-reference";
import type { Express, Response } from "express";
import { openApiSpec } from "../scaler/config.js";
export const setupRoutes = (app: Express) => {
/**
* @openapi
* /:
* get:
* summary: Health check
* responses:
* 200:
* description: Success
*/
app.get("/", (_, res: Response) => {
res.status(200).json({
success: true,
message: "This is just an example of this working",
});
});
app.get("/api/docs.json", (_, res) => {
res.json(openApiSpec);
});
app.use(
"/api/dos",
apiReference({
// Put your OpenAPI url here:
url: "/openapi.json",
theme: "purple",
}),
);
};

View File

@@ -0,0 +1,38 @@
//import path from "node:path";
//import { fileURLToPath } from "node:url";
import type { OpenAPIV3_1 } from "openapi-types";
//const __filename = fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
// const port = 3000;
export const openApiSpec: OpenAPIV3_1.Document = {
openapi: "3.1.0",
info: {
title: "LST API",
version: "3.0.0",
description: "Label System Tracking API",
},
servers: [
{
url: "http://localhost:3000",
description: "Development server",
},
],
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
bearerFormat: "JWT",
},
},
},
paths: {},
tags: [
{ name: "Health", description: "Health check endpoints" },
{ name: "Printing", description: "Label printing operations" },
{ name: "Silo", description: "Silo management" },
{ name: "TMS", description: "TMS integration" },
],
};