Skip to content

Commit 784f543

Browse files
committed
routes/apps.ts: Implement /api/applications endpoint
1 parent 3a4b19d commit 784f543

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/node/routes/apps.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as express from "express"
2+
import { PluginAPI } from "../plugin"
3+
4+
export function router(papi: PluginAPI): express.Router {
5+
const router = express.Router()
6+
7+
router.get("/", async (req, res) => {
8+
res.json(await papi.applications())
9+
})
10+
11+
return router
12+
}

src/node/routes/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import * as proxy from "./proxy"
2222
import * as _static from "./static"
2323
import * as update from "./update"
2424
import * as vscode from "./vscode"
25+
import * as apps from "./apps"
2526

2627
declare global {
2728
// eslint-disable-next-line @typescript-eslint/no-namespace
@@ -97,6 +98,7 @@ export const register = async (app: Express, server: http.Server, args: Defaulte
9798
const papi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH)
9899
await papi.loadPlugins()
99100
papi.mount(app)
101+
app.use("/api/applications", apps.router(papi))
100102

101103
app.use(() => {
102104
throw new HttpError("Not Found", HttpCode.NotFound)

0 commit comments

Comments
 (0)