Viewing version 0.5.0. Open the latest package page.

shelf

0.5.0

Web Server Middleware for Dart

Download archive

Readme

Web Server Middleware for Dart

Introduction

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.
  • Flexibliity to return a simple string or a byte stream with the same model.

Example

See example/example_server.dart

import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as io;

void main() {
  var handler = const shelf.Pipeline().addMiddleware(shelf.logRequests())
      .addHandler(_echoRequest);

  io.serve(handler, 'localhost', 8080).then((server) {
    print('Serving at http://${server.address.host}:${server.port}');
  });
}

shelf.Response _echoRequest(shelf.Request request) {
  return new shelf.Response.ok('Request for "${request.url}"');
}

Inspiration

Changelog

0.5.0

  • Renamed Stack to Pipeline.

0.4.0

  • Access to headers for Request and Response is now case-insensitive.

  • The constructor for Request has been simplified.

  • Request now exposes url which replaces pathInfo, queryString, and pathSegments.

0.3.0+9

  • Removed old testing infrastructure.

  • Updated documentation address.

0.3.0+8

  • Added a dependency on the http_parser package.

0.3.0+7

  • Removed unused dependency on the mime package.

0.3.0+6

  • Added a dependency on the string_scanner package.

0.3.0+5

  • Updated pubspec details for move to Dart SDK.

0.3.0 2014-03-25

  • Response
    • NEW! int get contentLength
    • NEW! DateTime get expires
    • NEW! DateTime get lastModified
  • Request
    • BREAKING contentLength is now read from headers. The constructor argument has been removed.
    • NEW! supports an optional Stream<List<int>> body constructor argument.
    • NEW! Stream<List<int>> read() and Future<String> readAsString([Encoding encoding])
    • NEW! DateTime get ifModifiedSince
    • NEW! String get mimeType
    • NEW! Encoding get encoding

0.2.0 2014-03-06

  • BREAKING Removed Shelf prefix from all classes.
  • BREAKING Response has drastically different constructors.
  • NEW! Response now accepts a body of either String or Stream<List<int>>.
  • NEW! Response now exposes encoding and mimeType.

0.1.0 2014-03-02

  • First reviewed release

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'shelf:0.5.0'
pubspec.yaml
name: shelf
version: 0.5.0
author: Dart Team <misc@dartlang.org>
description: Web Server Middleware for Dart
homepage: http://www.dartlang.org
environment:
  sdk: '>=1.2.0 <2.0.0'
documentation: https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/shelf
dependencies:
  collection: '>=0.9.1 <0.10.0'
  http_parser: '>=0.0.0 <0.1.0'
  path: '>=1.0.0 <2.0.0'
  stack_trace: '>=0.9.2 <0.10.0'
dev_dependencies:
  http: '>=0.9.2 <0.11.0'
  scheduled_test: '>=0.10.0 <0.11.0'
  unittest: '>=0.10.0 <0.11.0'

Version history

VersionPublishedArchiveSHA-256
0.0.0-devCached · Upstream SHA-256 matchedDownload4afe7167…1b7018
0.0.0-dev+1Cached · Upstream SHA-256 matchedDownloadbf52b1ad…9134c7
0.0.1Cached · Upstream SHA-256 matchedDownloadbff176f0…3215a2
0.1.0Cached · Upstream SHA-256 matchedDownload568505d6…2af414
0.2.0Cached · Upstream SHA-256 matchedDownload2acad0d2…a59f3a
0.3.0Cached · Upstream SHA-256 matchedDownloada2ab589e…52ae28
0.3.0+1Cached · Upstream SHA-256 matchedDownloade90d8386…8a7ff6
0.3.0+2Cached · Upstream SHA-256 matchedDownload3597889d…91ec5f
0.3.0+3Cached · Upstream SHA-256 matchedDownloadc0074eb5…085beb
0.3.0+4Cached · Upstream SHA-256 matchedDownloadea625f24…0344bb
0.3.0+6Cached · Upstream SHA-256 matchedDownloadd25f50dc…6dbaec
0.3.0+7Cached · Upstream SHA-256 matchedDownloadef72a780…0c0290
0.3.0+8Cached · Upstream SHA-256 matchedDownload9c1e66ae…219e65
0.4.0Cached · Upstream SHA-256 matchedDownload3b08fb62…df8108
0.5.0Cached · Upstream SHA-256 matchedDownloada3ee1d64…e49b8c
0.5.0+1Cached · Upstream SHA-256 matchedDownload278b4983…fee4b0
0.5.1Cached · Upstream SHA-256 matchedDownloadd9f531b2…7e93f8
0.5.1+1Cached · Upstream SHA-256 matchedDownload022aaed8…ccd73c
0.5.2Cached · Upstream SHA-256 matchedDownload74ce1e60…ab62d5
0.5.3Cached · Upstream SHA-256 matchedDownload4b34cf05…c2e046
0.5.4Cached · Upstream SHA-256 matchedDownload1d03f958…235fda
0.5.4+1Cached · Upstream SHA-256 matchedDownload9369e89d…42555e
0.5.4+2Cached · Upstream SHA-256 matchedDownload82366dae…7f3743
0.5.4+3Cached · Upstream SHA-256 matchedDownload38e64be0…9924cf
0.5.5Cached · Upstream SHA-256 matchedDownloade1813b8a…3988f1
0.5.5+1Cached · Upstream SHA-256 matchedDownload2d75f5b2…516e72
0.5.6Cached · Upstream SHA-256 matchedDownload2034faee…0d91df
0.5.7Cached · Upstream SHA-256 matchedDownloadceb5c0cc…22f68e
0.6.0Cached · Upstream SHA-256 matchedDownload6f5c8021…faca7b
0.6.1Cached · Upstream SHA-256 matchedDownload84755ef6…a6a1d6
0.6.1+1Cached · Upstream SHA-256 matchedDownload1f53eb9d…74c22d
0.6.1+2Cached · Upstream SHA-256 matchedDownload313d3c27…08116a
0.6.1+3Cached · Upstream SHA-256 matchedDownloadc00be6a3…22b311
0.6.2Cached · Upstream SHA-256 matchedDownloadc7a20d3d…3ee237
0.6.2+1Cached · Upstream SHA-256 matchedDownload8de62625…06ef8a
0.6.3Cached · Upstream SHA-256 matchedDownload93bf93b2…341d4a
0.6.3+1Cached · Upstream SHA-256 matchedDownload59b4d09c…5838ba
0.6.4Cached · Upstream SHA-256 matchedDownloada1563783…364942
0.6.4+1Cached · Upstream SHA-256 matchedDownloadc2fbffc4…6385b3
0.6.4+2Cached · Upstream SHA-256 matchedDownload02945044…cbed43
0.6.4+3Cached · Upstream SHA-256 matchedDownload3cb4475a…19c1af
0.6.5Cached · Upstream SHA-256 matchedDownload52177a1e…c7b28d
0.6.5+1Cached · Upstream SHA-256 matchedDownloadcb7ba373…ca4744
0.6.5+2Cached · Upstream SHA-256 matchedDownload9d70d71e…b5b8ee
0.6.5+3Cached · Upstream SHA-256 matchedDownload70f564e7…5fd45e
0.6.6Cached · Upstream SHA-256 matchedDownload22e2aa03…954d92
0.6.7Cached · Upstream SHA-256 matchedDownload3c1000c2…4237c9
0.6.7+1Cached · Upstream SHA-256 matchedDownloadbff10984…175e95
0.6.7+2Cached · Upstream SHA-256 matchedDownloade5abb9e0…3b8f03
0.6.8Cached · Upstream SHA-256 matchedDownload9818547d…ff1acb
0.7.0Cached · Upstream SHA-256 matchedDownload654dc74d…c7e98e
0.7.1Cached · Upstream SHA-256 matchedDownloadb6f70437…1a3808
0.7.2Cached · Upstream SHA-256 matchedDownload18842d10…6511d1
0.7.3Cached · Upstream SHA-256 matchedDownloadc0043920…a9bead
0.7.3+1Cached · Upstream SHA-256 matchedDownload32ddaace…bcc0c6
0.7.3+2Cached · Upstream SHA-256 matchedDownload52ecabc1…ddfd5f
0.7.3+3Cached · Upstream SHA-256 matchedDownloaddd4a28b1…1d84e5
0.7.4Cached · Upstream SHA-256 matchedDownload10b99738…99171e
0.7.4+1Cached · Upstream SHA-256 matchedDownloade51ec952…531b28
0.7.5Cached · Upstream SHA-256 matchedDownloadc256a075…2486ff
0.7.6Cached · Upstream SHA-256 matchedDownload86888c62…ea7b89
0.7.7Cached · Upstream SHA-256 matchedDownload739463c8…c485cf
0.7.8Cached · Upstream SHA-256 matchedDownload257f7b85…30988a
0.7.9Cached · Upstream SHA-256 matchedDownloadd16d1197…80ee37
1.0.0-nullsafety.0Cached · Upstream SHA-256 matchedDownloade6536ccc…18f367
1.0.0Cached · Upstream SHA-256 matchedDownloadc0710a5c…d361c6
1.1.0Cached · Upstream SHA-256 matchedDownloadc2f658d2…258901
1.1.1Cached · Upstream SHA-256 matchedDownloadcb24b18e…fafe55
1.1.2Cached · Upstream SHA-256 matchedDownload83ad9c33…90f0d7
1.1.3Cached · Upstream SHA-256 matchedDownload85a7ff40…8d0a1f
1.1.4Cached · Upstream SHA-256 matchedDownload26d22c68…8d6de5
1.2.0Cached · Upstream SHA-256 matchedDownloadc240984c…18421d
1.3.0Cached · Upstream SHA-256 matchedDownload4592f6cb…ddc0c3
1.3.1Cached · Upstream SHA-256 matchedDownloadf27c6406…1026d7
1.3.2Cached · Upstream SHA-256 matchedDownload8ec60759…a30ea0
1.4.0Cached · Upstream SHA-256 matchedDownloadc24a9613…73682c
1.4.1Cached · Upstream SHA-256 matchedDownloadad29c505…180fa4
1.4.2Cached · Upstream SHA-256 matchedDownloade7dd780a…39ef12
1.4.3Cached · Upstream SHA-256 matchedDownloade75e9cf3…3d5a48

Dependencies

collection "\u003e=0.9.1 \u003c0.10.0"

http_parser "\u003e=0.0.0 \u003c0.1.0"

path "\u003e=1.0.0 \u003c2.0.0"

stack_trace "\u003e=0.9.2 \u003c0.10.0"