← All procedures

server.start

Start CLI server as background daemon

CLI
Package
@procedures/peer · README
Path
["server","start"]
CLI
mark server start
As data
{"$proc":["server","start"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/peer"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["server","start"], {});
console.log(JSON.stringify(result));

From the command line

$ mark server start

As data, in a program

{ "$proc": ["server", "start"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
portintegernoThe port to listen on (default: 3000)
hoststringnoThe host to bind to (default: 127.0.0.1)
transport"http" | "websocket" | "both"noThe transport (default: http)

Output

FieldTypeRequiredDefaultDescription
successbooleanyesTrue when the server started
pidnumbernoThe process id of the server
portnumbernoThe port of the server
endpointstringnoThe URL of the server
logFilestringnoThe log file of the server
messagestringyesA message about the result
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "port": {
        "description": "The port to listen on (default: 3000)",
        "type": "integer",
        "minimum": 1,
        "maximum": 65535
      },
      "host": {
        "description": "The host to bind to (default: 127.0.0.1)",
        "type": "string",
        "minLength": 1
      },
      "transport": {
        "description": "The transport (default: http)",
        "type": "string",
        "enum": [
          "http",
          "websocket",
          "both"
        ]
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "success": {
        "type": "boolean",
        "description": "True when the server started"
      },
      "pid": {
        "description": "The process id of the server",
        "type": "number"
      },
      "port": {
        "description": "The port of the server",
        "type": "number"
      },
      "endpoint": {
        "description": "The URL of the server",
        "type": "string"
      },
      "logFile": {
        "description": "The log file of the server",
        "type": "string"
      },
      "message": {
        "type": "string",
        "description": "A message about the result"
      }
    },
    "required": [
      "success",
      "message"
    ],
    "additionalProperties": {}
  }
}