Line

ui/server/src/newProjectApi

(part of #562) -- "New project": one name in, an initialised project in the caller's workspace out.

Cockpit server, v0.9. Source: ui/server/src/newProjectApi.mjs.

Variables#

NEW_PROJECT_FRAMEWORKS#

const NEW_PROJECT_FRAMEWORKS: readonly string[]

Defined in: ui/server/src/newProjectApi.mjs:22

Functions#

createNewProjectRouter()#

createNewProjectRouter(deps): any

Defined in: ui/server/src/newProjectApi.mjs:73

Parameters#

deps

runInit is the in-process construct init (captured); openProject makes dir the current project and returns the settings body the client renders (index.mjs passes the same closure POST /api/settings uses).

clientOrigin?

string

openProject

(dir) => any

runInit

(dir, framework) => Promise<{ error?: string; ok: boolean; output?: string[]; }>

Returns#

any


planNewProject()#

planNewProject(body): { dir: string; framework: string; name: string; ok: true; } | { body: any; ok: false; status: number; }

Defined in: ui/server/src/newProjectApi.mjs:31

Validate the request and return the folder to create, or a refusal. Pure of side effects: nothing is written.

Parameters#

body

unknown

Returns#

{ dir: string; framework: string; name: string; ok: true; } | { body: any; ok: false; status: number; }