Skip to content

feat(serve): Add POST /shutdown endpoint to gracefully stop the server #12

@SizzleUnrlsd

Description

@SizzleUnrlsd

Description:

Introduce a new administrative HTTP route POST /shutdown to allow an authorized client to request a graceful server shutdown. When invoked, the server should:
• Acknowledge the request (preferably 202 Accepted) before shutting down.
• Stop accepting new connections/requests.
• Let in-flight requests complete (or enforce a configurable timeout).
• Flush logs, close sockets, and release resources cleanly.
• Terminate the process or exit the main event loop.

Security constraints:

This endpoint must be protected to avoid accidental/unauthorized shutdown (e.g., localhost-only, or require an admin token via Authorization: Bearer ). It should also be idempotent: repeated calls while shutting down return a clear “already shutting down” response rather than re-triggering shutdown logic.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions