Skip to content

Commit 348cf22

Browse files
replace API health route by version route
1 parent fbede71 commit 348cf22

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

API.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,17 @@ possible error codes:
224224
Public API
225225
----------
226226

227-
### health
227+
### version
228228

229229
Return `200` if W instal is healthy.
230230

231-
GET /api/v0/health
231+
GET /api/v0/version
232232

233+
```json
234+
{
235+
"version": "v2.3.0"
236+
}
237+
```
233238

234239
### auth
235240

app/class/Controllerapiconnect.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ public function auth(): never
3636
}
3737
}
3838

39-
public function health(): never
39+
public function version(): never
4040
{
41-
$this->shortresponse(200, "W is healthy");
41+
http_response_code(200);
42+
header('Content-type: application/json; charset=utf-8');
43+
echo json_encode(['version' => getversion()], JSON_PRETTY_PRINT);
44+
exit;
4245
}
4346
}

app/class/Routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function match(): void
3030
['PUT', '/api/v0/page/[cid:page]', 'Controllerapipage#put', 'apipageput'],
3131
['GET', '/api/v0/user/[cid:user]', 'Controllerapiuser#get', 'apiuserget'],
3232
['POST', '/api/v0/auth', 'Controllerapiconnect#auth', 'apiconnectauth'],
33-
['GET', '/api/v0/health', 'Controllerapiconnect#health', 'apiconnecthealth'],
33+
['GET', '/api/v0/version', 'Controllerapiconnect#version', 'apiconnectversion'],
3434
['POST', '/api/v0/media/upload/[*:path]', 'Controllerapimedia#upload', 'apimediaupload'],
3535
['DELETE', '/api/v0/media/[*:path]', 'Controllerapimedia#delete', 'apimediadelete'],
3636
['POST', '/api/v0/workspace', 'Controllerapiworkspace#update', 'apiworkspaceupdate'],

0 commit comments

Comments
 (0)