stop-server
Learn how to stop a running server.
This action stops a server previously started by start-server.
The server is identified by the ID stored in the result of the start-server action.
Example
The following template starts a server and stops it after the user presses a key:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Server lifecycle", "description": "Starts and stops a development server.", "actions": [ { "name": "start-server", "result": { "id": "serverId" } }, { "name": "prompt", "type": "keypress", "message": "Press any key to stop the server" }, { "name": "stop-server", "id": "${this.serverId}" } ]}To apply this template, run:
npm
npx croct@latest use template.json5Properties
These are the supported properties:
- namestring
The action identifier. Always stop-server for this action.
- idstring
The ID of the server to stop.
This is the value stored by the start-server action's result.id property.