p-hatan/ mirror

pub repository

mirror.p-hatan.ir

shelf

0.5.1

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.1

  • Add a context map to Request and Response for passing data among handlers and middleware.

0.5.0+1

  • Allow scheduled_test development dependency up to v0.12.0

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
pubspec.yaml
name: shelf
version: 0.5.1
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.12.0'
  unittest: '>=0.10.0 <0.11.0'

Version history

VersionPublishedArchiveSHA-256
0.0.0-dev2014-01-02T04:21:30.895900ZDownload4afe71670b99facba517bec1f61284a898f4f6e9b08f775ebfbd6385271b7018
0.0.0-dev+12014-01-03T19:23:52.752120ZDownloadbf52b1ade3612fc8525da0c8b48c9ea01f98b65d4b2a4405f3df904db29134c7
0.0.12014-03-02T21:47:55.269770ZDownloadbff176f0e52173cfba29c3f36fa5bf5ba195899253c42341a49c952edb3215a2
0.1.02014-03-03T04:17:39.447740ZDownload568505d6d06567bbf59b6884ae55c578b161a3bde049760402a3efc97e2af414
0.2.02014-03-06T19:30:43.874240ZDownload2acad0d25ea5d9ab171b629560afdbc647638af4a3e13f3147f078395aa59f3a
0.3.02014-03-25T22:54:04.048770ZDownloada2ab589e45ae87f52d92fc6e8dc4f98a1c9da73820b2407e4bbd07bf2452ae28
0.3.0+12014-03-29T04:57:59.469200ZDownloade90d8386034d8ac3be45587a14382429e3a5f441e64f7ec304a191f7398a7ff6
0.3.0+22014-03-29T17:20:37.346960ZDownload3597889d2712d6ec1583f85d03b735ee5cfe8d171084028cd338b805ad91ec5f
0.3.0+32014-03-29T17:22:36.825620ZDownloadc0074eb5b6c7c2415f6f0c84efa4e04a686c43bbbf5b6b463969c8cbc7085beb
0.3.0+42014-03-31T23:55:15.696990ZDownloadea625f245bc7aa691f851326fac15e33b5c690246bf201dfb7ae7b55360344bb
0.3.0+62014-04-02T21:00:31.644650ZDownloadd25f50dc4d8a07a4dce67a62ae8b1a20d396693d2ab3ca7eb1fa6bce116dbaec
0.3.0+72014-04-02T22:17:43.059830ZDownloadef72a7801b5d9360224c6bdc64727d4d7e3b6fe0ac714fe72610e8fcec0c0290
0.3.0+82014-04-03T00:55:31.518580ZDownload9c1e66ae752a2ad0c65ba1ef0975393dbc06cd48c87775a20d30fa9960219e65
0.4.02014-04-09T01:04:14.555070ZDownload3b08fb62b25d73ec0c83f85ebae64312de7d8286aca1cf3eb3d36e34eddf8108
0.5.02014-04-15T21:36:46.815050ZDownloada3ee1d6497a55e615463753ef87d4b0abd26c3238aa7d06ba8ba33f06fe49b8c
0.5.0+12014-04-15T23:28:42.888530ZDownload278b49838c82f1e382129a1d26960e91cb6dbb579cb85e69a8c1efb4cefee4b0
0.5.12014-04-19T20:23:23.664390ZDownloadd9f531b2abc38e41566b527ceb9888907042bfe6e1eb0fcf6249f712847e93f8
0.5.1+12014-04-25T18:18:29.944920ZDownload022aaed807297854b5633c788d9697732bada6fa4447a746f35af50b5cccd73c
0.5.22014-05-19T23:06:58.011930ZDownload74ce1e60a632481ecda152c93971c32bbaf625fc7350aa6b18851adb69ab62d5
0.5.32014-05-24T00:35:48.768220ZDownload4b34cf05d5bcfa259ea947c87013d8cb0e5700c697bed6a409babd3bfdc2e046
0.5.42014-05-28T00:50:56.801980ZDownload1d03f958c69f79b41848961cf20ac00ef6887837cc9ca2220edc601009235fda
0.5.4+12014-06-02T18:42:13.778200ZDownload9369e89d137d2cabb24a8ac0e81f439b0a882adfbb09fd9ebbca8d12d442555e
0.5.4+22014-07-07T23:54:22.795470ZDownload82366dae4eae3d62e0a2e234aa903820ade568e09c21f6d3efc53570847f3743
0.5.4+32014-08-26T19:51:23.025180ZDownload38e64be014fcd16e9081182decdaa923f7136854ca7cd9310f52feb41c9924cf
0.5.52014-09-23T21:49:55.098930ZDownloade1813b8a976a108fdaacb777f1f5931f2a5698f319bc6c9a1338b220cf3988f1
0.5.5+12014-10-14T17:39:16.515670ZDownload2d75f5b2fd4e911b27fa5374785825aea5cbc1be607570b0dff1543f2e516e72
0.5.62014-11-24T21:25:56.562160ZDownload2034faee5635e240b776c3e89086eac6da8af782e3b139d5fd811c63db0d91df
0.5.72015-01-21T02:16:45.987590ZDownloadceb5c0cc2fb6a816e7feaad7cad2a3e9431842fe98c7a0ee050df8662c22f68e
0.6.02015-03-04T23:48:16.805910ZDownload6f5c80218e702533845d1ad52193d135ba2b3a3ac5f90c1e1de62b23c5faca7b
0.6.12015-03-25T22:14:19.013280ZDownload84755ef640744b706f9053877665140d40f2c88f7781d1bd3968b529bca6a1d6
0.6.1+12015-03-25T22:32:47.282770ZDownload1f53eb9d75a548906041dd954af4efe5959949d8da31a6d804d4e30fc674c22d
0.6.1+22015-05-11T18:06:37.080810ZDownload313d3c272e2e86f53ca222e8907af8269744a4d680cf157c4c66eb54c808116a
0.6.1+32015-07-06T20:08:45.815ZDownloadc00be6a3b3f76d358eb9d3a0578c4c98a5ef9ae25b80b9f4fee2cedf7422b311
0.6.22015-07-06T21:58:07.268ZDownloadc7a20d3de8c59b6adf002e75c45ea67c946e21f9cfd16d3722862948e53ee237
0.6.2+12015-08-26T19:16:57.427ZDownload8de626251fceae4520da38de3cf50e4ada6b0f6a2c845b6ca097614ca406ef8a
0.6.32015-09-01T02:02:04.879ZDownload93bf93b28820d22f522b30cc615f07327dfa93a3fc64aace4d44b03c54341d4a
0.6.3+12015-10-21T00:21:38.315ZDownload59b4d09c05c9960531d29564aab4f439f788453117dbfe1076f67124e05838ba
0.6.42015-10-26T23:03:14.853ZDownloada15637837af36947dad463901fafe31f2b0854111f7f33c78a71f4a183364942
0.6.4+12015-10-28T23:24:44.383ZDownloadc2fbffc4a9a4f3fb8afe25555cfff0de6abdff38d17125dfbad72a56b26385b3
0.6.4+22015-11-18T00:24:11.914ZDownload02945044d2a1fe0b68fc8ba3a24c38a2b21fd9875a09e7b89cfe4bf137cbed43
0.6.4+32015-12-14T22:22:21.287ZDownload3cb4475add687430d03510ce4da56a533193ad3354270c054186e4680a19c1af
0.6.52016-01-28T22:37:40.524ZDownload52177a1e99a0f857281cd428a55304fbf9f46ade764e8780efa2300e37c7b28d
0.6.5+12016-05-04T18:11:49.132ZDownloadcb7ba37351f542cf03586bdf21951401c5d2f6ce78de2d0263f8292253ca4744
0.6.5+22016-05-05T17:21:08.202ZDownload9d70d71e679f344a4c9744e0edce54815c01cf9e3268d5f27868d655e2b5b8ee
0.6.5+32016-08-25T20:51:11.151ZDownload70f564e70216fda2f6acdc5cd6eee9225c3cca8ec6c0c4d84b5ac5b0fb5fd45e
0.6.62016-10-24T22:29:47.317ZDownload22e2aa035b95542a95bfa9fa62c88e38ca6024f2844c10471be707c5e6954d92
0.6.72016-10-26T20:23:15.178ZDownload3c1000c28b58f8b829c3b65acf474dec680fc789062336a44f694f33a14237c9
0.6.7+12016-10-26T20:58:19.817ZDownloadbff1098421f3d91f17ec7f6dfeaab94167b90b88f14acbeb1c275629aa175e95
0.6.7+22016-12-06T23:27:18.653ZDownloade5abb9e0731acc24480df302a9b4a0c2bc46b976dd24f24cf4347be1833b8f03
0.6.82017-06-23T00:27:45.164869ZDownload9818547d45dbde101628d14f4be3e3c100412c2ce993077b8ff8eae448ff1acb
0.7.02017-08-29T22:04:21.858822ZDownload654dc74da4ad9fe1179d0b7f4fbf3fd43564bf7b57486ee057bca1c0e8c7e98e
0.7.12017-10-26T19:17:52.532829ZDownloadb6f70437bb743937198ad1107e49af2f1adf54d193a83d8c20a7662b3c1a3808
0.7.22018-01-04T20:38:48.380923ZDownload18842d1020dcc041a7e347e6183be6854a3f44b93c400cdb24386e863a6511d1
0.7.32018-05-02T23:15:13.592126ZDownloadc0043920f19d4329109562f4d57f7598ae98f4f3894a1fec0ea77def98a9bead
0.7.3+12018-05-22T15:25:18.538698ZDownload32ddaacee31749472382d3feff300f25224a8a22f4f8a0daae34bb7745bcc0c6
0.7.3+22018-07-10T00:10:58.426334ZDownload52ecabc1b0197162c0736f90877d1d834007a46c1c0004dec016a3c2a9ddfd5f
0.7.3+32018-07-16T16:40:59.854134ZDownloaddd4a28b16310c3501a573716bd3025710823b2728909c4856f96bd36901d84e5
0.7.42018-12-17T17:13:38.380190ZDownload10b9973865473afb3665f279551e2844c2828738a5aa4b4a0b08f9262b99171e
0.7.4+12019-03-27T20:29:28.837278ZDownloade51ec952cbe2e93eaa3a848d0291e1e5ce9b229c15f9cc1656521c572c531b28
0.7.52019-04-01T16:03:31.169159ZDownloadc256a07581278075dc1ccd0f8c63c4177f74280dded1e70107371125242486ff
0.7.62020-06-18T16:47:47.249142ZDownload86888c6295f3b6c6e29054c45b389da7b8389b5c8da88cb17a508f91bbea7b89
0.7.72020-06-19T17:13:37.434539ZDownload739463c850fd26279ce763fa883c685a26fcf7600d7b8c6f9e72253f3dc485cf
0.7.82020-08-12T15:59:44.584570ZDownload257f7b850c9278dee6d63a1f553e8ff080f0d95e6b37f30ae39303f4d030988a
0.7.92020-08-14T03:32:37.050758ZDownloadd16d1197f877e814f767be03c1c5940a397ae0ddb46dcfb9b5465074bb80ee37
1.0.0-nullsafety.02021-01-29T16:27:07.654638ZDownloade6536cccce2ed77e0f5a3913ba60a181e6be5d73ba1ddeb39edf1e372818f367
1.0.02021-02-05T20:51:35.173441ZDownloadc0710a5ca61f1a96e9aae37081040f537c1b96265040edeb70c8817a10d361c6
1.1.02021-03-17T19:41:46.781390ZDownloadc2f658d28ec86857657dec3579e2db4dc5a6c477b6aecde870e77f0682258901
1.1.12021-04-23T23:45:40.691720ZDownloadcb24b18e3d32d08418e82daeef644c80ed616288de5e34cbae5c05879bfafe55
1.1.22021-05-07T20:51:34.677176ZDownload83ad9c33171d30672abd22f6bb449205e83fcf6dc4f13a4bd5801c388590f0d7
1.1.32021-05-13T15:48:06.050824ZDownload85a7ff4073f37b55033702fffb6d2ab33978ac1d1fee07ce1e00cd143f8d0a1f
1.1.42021-05-13T19:24:52.844929ZDownload26d22c68cf9c349fb1adb4a830da3e014cb5f7ed9cc57f721d9d9e20cf8d6de5
1.2.02021-07-08T19:24:05.365533ZDownloadc240984c924796e055e831a0a36db23be8cb04f170b26df572931ab36418421d
1.3.02022-03-28T18:29:51.395586ZDownload4592f6cb6c417632ebdfb63e4db42a7e3ad49d1bd52d9f93b6eb883035ddc0c3
1.3.12022-06-16T01:11:10.130313ZDownloadf27c6406c89ab3921ed4a3bbdc38d48676f8b78fe537cbdbeb0d2c0f661026d7
1.3.22022-07-28T18:57:56.641660ZDownload8ec607599dd0a78931a5114cdac7d609b6dbbf479a38acc9a6dba024b2a30ea0
1.4.02022-09-20T23:40:25.736807ZDownloadc24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c
1.4.12023-05-03T19:28:35.057465ZDownloadad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
1.4.22024-06-21T17:47:04.083038ZDownloade7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12
1.4.32026-10-16T22:20:00.002809ZDownloade75e9cf311d7fd712048038cc17c25199c38536c20330d53e7db058b543d5a48

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"