Explorar o código

Add Health check endpoint at /api/service/health-check

Daniel Supernault %!s(int64=2) %!d(string=hai) anos
pai
achega
ff58f9707f
Modificáronse 2 ficheiros con 17 adicións e 0 borrados
  1. 16 0
      app/Http/Controllers/HealthCheckController.php
  2. 1 0
      routes/api.php

+ 16 - 0
app/Http/Controllers/HealthCheckController.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+
+class HealthCheckController extends Controller
+{
+    public function get(Request $request)
+    {
+        return response('OK')->withHeaders([
+            'Content-Type' => 'text/plain',
+            'Cache-Control' => 'max-age=0, must-revalidate, no-cache, no-store'
+        ]);
+    }
+}

+ 1 - 0
routes/api.php

@@ -17,6 +17,7 @@ Route::get('.well-known/nodeinfo', 'FederationController@nodeinfoWellKnown')->na
 Route::get('.well-known/host-meta', 'FederationController@hostMeta')->name('well-known.hostMeta');
 Route::get('.well-known/host-meta', 'FederationController@hostMeta')->name('well-known.hostMeta');
 Route::redirect('.well-known/change-password', '/settings/password');
 Route::redirect('.well-known/change-password', '/settings/password');
 Route::get('api/nodeinfo/2.0.json', 'FederationController@nodeinfo');
 Route::get('api/nodeinfo/2.0.json', 'FederationController@nodeinfo');
+Route::get('api/service/health-check', 'HealthCheckController@get');
 
 
 Route::group(['prefix' => 'api'], function() use($middleware) {
 Route::group(['prefix' => 'api'], function() use($middleware) {