搜索插件、代码仓与 APP 分类

插件详情v1.4.3

shelf

一个用于 Web 服务器中间件的模型,鼓励组合和轻松重用。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1570万
喜欢数
1050
Pub 分数
160

安装插件

flutter pub add shelf

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Shelf 是一个 Dart 包,提供了一个轻量级、模块化的框架,用于构建 Web 服务器和中间件。它强调组合性,允许开发者通过简单、函数式的 API 创建灵活且可重用的服务器逻辑。中间件组件可以串联在一起,高效地处理请求和响应,使其非常适合小型服务和复杂的后端系统。Shelf 设计时注重简洁性和互操作性,可无缝集成到 Dart 生态系统中,并支持包括 Web、移动和桌面在内的多个平台。

适合场景

  • 构建 REST API
  • 创建自定义Web服务器
  • 实现请求/响应中间件
  • 开发微服务
  • 处理 HTTP 路由和身份验证

主要特点

  • 模块化中间件架构
  • 易于组合的请求处理程序
  • 跨平台支持
  • 轻量且开销极小
  • 内置对流式和异步操作的支持

适合对象

  • 后端开发人员
  • API 创建者
  • 基于 Dart 的 Web 服务构建器
  • 微服务架构师
  • 学习 HTTP 服务器概念

使用建议

  • 不是完整的 Web 框架(需要额外的包来实现路由)
  • 与更大的框架相比,内置功能有限
  • 需要手动设置才能启用高级功能

原始 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.

所属分类

依赖

依赖清单 6 项

源码仓库

使用此插件的项目

所在榜单