Archived
1
0

routes/apps.ts: Add example output

This commit is contained in:
Anmol Sethi 2020-11-03 21:49:10 -05:00
parent 2a13d003d3
commit af73b96313
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
2 changed files with 28 additions and 0 deletions

View File

@ -3,6 +3,8 @@ import { PluginAPI } from "../plugin"
/** /**
* Implements the /api/applications endpoint * Implements the /api/applications endpoint
*
* See typings/pluginapi.d.ts for details.
*/ */
export function router(papi: PluginAPI): express.Router { export function router(papi: PluginAPI): express.Router {
const router = express.Router() const router = express.Router()

View File

@ -42,12 +42,38 @@ import * as express from "express"
* *
* If two plugins are found with the exact same name, then code-server will * If two plugins are found with the exact same name, then code-server will
* use the first one and emit a warning. * use the first one and emit a warning.
*
*/
/* Programmability
* *
* There is also a /api/applications endpoint to allow programmatic access to all * There is also a /api/applications endpoint to allow programmatic access to all
* available applications. It could be used to create a custom application dashboard * available applications. It could be used to create a custom application dashboard
* for example. An important difference with the API is that all application paths * for example. An important difference with the API is that all application paths
* will be absolute (i.e have the plugin path prepended) so that they may be used * will be absolute (i.e have the plugin path prepended) so that they may be used
* directly. * directly.
*
* Example output:
*
* [
* {
* "name": "Test App",
* "version": "4.0.0",
* "iconPath": "/test-plugin/test-app/icon.svg",
* "path": "/test-plugin/test-app",
* "description": "This app does XYZ.",
* "homepageURL": "https://example.com",
* "plugin": {
* "name": "test-plugin",
* "version": "1.0.0",
* "modulePath": "/Users/nhooyr/src/cdr/code-server/test/test-plugin",
* "displayName": "Test Plugin",
* "description": "Plugin used in code-server tests.",
* "routerPath": "/test-plugin",
* "homepageURL": "https://example.com"
* }
* }
* ]
*/ */
/** /**