Implement /status Health Check Endpoint and Refactor Plugin Registration

オープン
#59 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript
領域
api, backend

調査の方向性

まず root-status.controller.ts と homeserver.module.ts を確認し、提案されているプラグイン登録とエラーハンドリングを理解します。GET / と GET /status が説明されているレスポンスを返すこと、および未知のルートがカスタムの Not-found レスポンスを使用することを確認してください。この issue では特定のテストファイルについて言及されていません。

索引モデルが issue の本文から書いたものです。

説明

Description

Added a new root-status.controller.ts that provides two routes:

  • GET / — returns a simple welcome message

  • GET /status — returns server uptime, current timestamp, and status

  • Registered this controller plugin in homeserver.module.ts.

  • Also added a custom 404 error handler using app.onError for cleaner “not found” responses.

Key Code Snippets

root-status.controller.ts
import { Elysia } from 'elysia';

export const rootStatusPlugin = new Elysia()
  .get('/', () => ({
    message: 'Matrix server is live. Try /status.',
  }))
  .get('/status', () => ({
    status: 'ok',
    uptime: process.uptime(),
    timestamp: new Date().toISOString(),
  }));
homeserver.module.ts
app.onError(({ code }) => {
  if (code === 'NOT_FOUND') {
    return {
      error: 'Route not found. Are you lost?',
    };
  }
});

If this looks good, I’d be happy to create a PR for these changes. Please assign it to me if so, happy to contribute!

主要言語
TypeScript
スター
17
フォーク
18
平均マージ
2時間 11分
マージ済み PR(30日)
2

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RocketChat/homeserver のほかの issue

RocketChat/homeserver の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。