Shelf is web server middleware for Dart that encourages composition and easy reuse.
Shelf makes it easy to create and compose web servers and parts of web servers.
A handler is any function that handles a shelf.Request and returns a shelf.Response. It can either handle the request itself–for example, a static file server that looks up the requested URI on the filesystem–or it can do some processing and forward it to another handler–for example, a logger that prints information about requests and responses to the command line.
The latter kind of handler is called “middleware”, since it sits in the middle of the server stack. Middleware can be thought of as a function that takes a handler and wraps it in another handler to provide additional functionality. A Shelf application is usually composed of many layers of middleware with one or more handlers at the very center; the shelf.Pipeline class makes this sort of application easy to construct.
Some middleware can also take multiple handlers and call one or more of them for each request. For example, a routing middleware might choose which handler to call based on the request’s URI or HTTP method, while a cascading middleware might call each one in sequence until one returns a successful response.
This is free and open source software.
Key Features
- 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.
Website: pub.dev/packages/shelf
Support: GitHub Code Repository
Developer: Dart Project Authors
License: BSD 3-Clause “New” or “Revised” License
Shelf is written in Dart. Learn Dart with our recommended free books and free tutorials.
Related Software
| Dart Web Frameworks | |
|---|---|
| Flutter | UI toolkit for building natively compiled applications |
| Jaspr | Modern web framework for building websites in Dart |
| Angel3 | Full-stack web framework that is build to streamline development |
| Shelf | Web server middleware |
| Jaguar | Full-stack production ready HTTP server framework built to be fast and simple |
| Angular | Fast and productive web framework |
| Alfred | Performant expressjs like web server / rest api framework |
| Start | Sinatra inspired web development framework |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

