Step 2 — Dev server and ping

Your app exists on disk; now prove it responds over HTTP.

What you will learn

  • Start the built-in dev server on port 8000
  • Call GET /api/v1/ping and a Moonlight welcome.ping action
Before you start

Start the server

From deskflow-api/:

php pionia serve

In a second terminal (same project root):

curl -s http://127.0.0.1:8000/api/v1/ping
Expected
{ "returnCode": 0, "returnMessage": "pong", "returnData": null }

Your first Moonlight POST

curl -s -X POST http://127.0.0.1:8000/api/v1/ \
  -H "Content-Type: application/json" \
  -d '{"service":"welcome","action":"ping"}'

Open services/WelcomeService.php, switches/MainSwitch.php, and environment/settings.ini — this service → switch → INI pattern repeats for DeskFlow.

Common mistakes

  • Connection refused — server not running or wrong PORT in .env (default 8000).
  • Missing Content-Type on POST — use application/json.