搜尋套件、儲存庫與 APP 分類

套件詳情v1.1.5

shelf_router_generator

一個與 package:build 兼容的建構器,根據來源註解為 shelf Web 框架產生請求路由。

AndroidiOSmacOSWindowsLinux
近 30 天下載
2.3萬
喜歡數
71
Pub 分數
140

安裝套件

flutter pub add shelf_router_generator

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

ShelfRouterGenerator 是 Shelf web framework 的建構時間程式碼產生器,會從原始註解建立請求路由器。它讓開發人員能使用簡單且易讀的註解在 Dart 程式碼中定義路由,這些註解會在建構階段處理,進而產生高效能的路由邏輯。此方法可減少重複程式碼,並透過在編譯時期捕捉路由錯誤來提升類型安全性。該套件與 `package:build` 系統完全整合,並支援 Dart 執行的所有主要平台。

適用情境

  • 使用註解路由處理程序定義 REST API
  • 產生類型安全的路由映射
  • 在基於書架的伺服器中自動化路由器樣板程式碼
  • 啟用路由設定的編譯時間驗證
  • 簡化 Web 服務中的複雜路由結構

主要特色

  • 基於註解的路由定義
  • 建構時間代碼生成
  • 類型安全的路由
  • 與套件:build 的整合
  • 對平台無關伺服器開發的支援

適合對象

  • 使用 Shelf 建構後端服務的開發人員
  • 優先考慮編譯時安全的團隊
  • 需要最少路由樣板的項目
  • 面向多個平台的 Dart 開發者
  • API密集型應用,具有結構化路由

使用建議

  • 需要 build_runner 進行代碼生成
  • 與動態路由相比,執行時間彈性較低
  • 需要理解建構系統工作流程
  • 不適用於執行時間路由設定
  • 可能會稍微增加建構時間

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Build Status

About Shelf

Shelf makes it easy to create and compose web servers and parts of web servers. How?

  • Expose a small set of simple types.
  • Map server logic into a simple function: a single argument for the request, the response is the return value.
  • Trivially mix and match synchronous and asynchronous processing.
  • Flexibility to return a simple string or a byte stream with the same model.

It was inspired by Connect for NodeJS and Rack for Ruby.

See the package:shelf readme for more information.

Packages

Package Description Issues Version
shelf A model for web server middleware that encourages composition and easy reuse. issues pub package
shelf_packages_handler A shelf handler for serving a packages/ directory. issues pub package
shelf_proxy A shelf handler for proxying HTTP requests to another server. issues pub package
shelf_router A convenient request router for the shelf web-framework, with support for URL-parameters, nested routers and routers generated from source annotations. issues pub package
shelf_router_generator A package:build-compatible builder for generating request routers for the shelf web-framework based on source annotations. issues pub package
shelf_static Static file server support for the shelf package and ecosystem. issues pub package
shelf_test_handler A Shelf handler that makes it easy to test HTTP interactions. issues pub package
shelf_web_socket A shelf handler that wires up a listener for every connection. issues pub package
_shelf_compliance HTTP/1.1 compliance and hardening tests. issues (not published)

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案