tambahan
This commit is contained in:
@@ -2,19 +2,19 @@ import Swagger from "@elysiajs/swagger";
|
||||
import Elysia from "elysia";
|
||||
import html from "./index.html";
|
||||
import apiAuth from "./server/middlewares/apiAuth";
|
||||
import AduanRoute from "./server/routes/aduan_route";
|
||||
import ApiKeyRoute from "./server/routes/apikey_route";
|
||||
import Auth from "./server/routes/auth_route";
|
||||
import CredentialRoute from "./server/routes/credential_route";
|
||||
import DarmasabaRoute from "./server/routes/darmasaba_route";
|
||||
import { convertOpenApiToMcp } from "./server/lib/mcp-converter";
|
||||
import UserRoute from "./server/routes/user_route";
|
||||
import LayananRoute from "./server/routes/layanan_route";
|
||||
import AduanRoute from "./server/routes/aduan_route";
|
||||
import UserRoute from "./server/routes/user_route";
|
||||
|
||||
import { cors } from "@elysiajs/cors";
|
||||
import { MCPRoute } from "./server/routes/mcp_route";
|
||||
import PengaduanRoute from "./server/routes/pengaduan_route";
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
const Docs = new Elysia({
|
||||
tags: ["docs"],
|
||||
}).use(
|
||||
@@ -27,6 +27,7 @@ const Api = new Elysia({
|
||||
prefix: "/api",
|
||||
tags: ["api"],
|
||||
})
|
||||
.use(Docs)
|
||||
.use(apiAuth)
|
||||
.use(ApiKeyRoute)
|
||||
.use(DarmasabaRoute)
|
||||
@@ -37,31 +38,13 @@ const Api = new Elysia({
|
||||
.use(PengaduanRoute);
|
||||
|
||||
const app = new Elysia()
|
||||
.use(Api)
|
||||
.use(Docs)
|
||||
.use(Auth)
|
||||
.get(
|
||||
"/.well-known/mcp.json",
|
||||
async () => {
|
||||
const baseUrl = process.env.BUN_PUBLIC_BASE_URL!;
|
||||
return await convertOpenApiToMcp(baseUrl);
|
||||
},
|
||||
{
|
||||
detail: {
|
||||
description: "MCP manifest",
|
||||
tags: ["MCP"],
|
||||
},
|
||||
},
|
||||
)
|
||||
.use(Api)
|
||||
|
||||
.use(MCPRoute)
|
||||
.get("/*", html)
|
||||
.onRequest(({ set }) => {
|
||||
set.headers["Access-Control-Allow-Origin"] = "*";
|
||||
set.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
|
||||
set.headers["Access-Control-Allow-Headers"] = "Content-Type";
|
||||
})
|
||||
.listen(3000, () => {
|
||||
console.log("Server running at http://localhost:3000");
|
||||
.listen(PORT, () => {
|
||||
console.log(`Server running at http://localhost:${PORT}`);
|
||||
});
|
||||
|
||||
export type ServerApp = typeof app;
|
||||
|
||||
Reference in New Issue
Block a user