{"name":"servie","version":"0.2.3","description":"Standard HTTP interfaces","main":"dist/index.js","types":"dist/index.d.ts","files":["dist/","typings.json","LICENSE","logo.svg"],"scripts":{"lint":"tslint \"src/**/*.ts\" --type-check --project tsconfig.json","build":"rm -rf dist/ && tsc","specs":"jest --coverage","test":"npm run -s lint && npm run -s build && npm run -s specs","prepublish":"typings install && npm run build"},"repository":{"type":"git","url":"git://github.com/blakeembrey/node-servie.git"},"keywords":["request","response","http","interface","req","res","server"],"author":{"name":"Blake Embrey","email":"hello@blakeembrey.com","url":"http://blakeembrey.me"},"license":"Apache-2.0","bugs":{"url":"https://github.com/blakeembrey/node-servie/issues"},"homepage":"https://github.com/blakeembrey/node-servie","devDependencies":{"jest":"^19.0.0","rimraf":"^2.5.4","tslint":"^5.0.0","tslint-config-standard":"^5.0.2","typescript":"^2.2.1","typings":"^2.1.0"},"dependencies":{"make-error-cause":"^1.2.2"},"gitHead":"c59e7f5141d8ca1e70c191830fa2abe654d25589","_id":"servie@0.2.3","_shasum":"b86fbfdfb8d122b00afe69556fc2922ffb58609a","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.3.0","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"dist":{"shasum":"b86fbfdfb8d122b00afe69556fc2922ffb58609a","tarball":"http://registry-npm.ywwl.com/servie/download/servie-0.2.3.tgz","integrity":"sha512-sOlLwdfzc9tEkZ/3SKua8imCcJYEysLgLITvpaPmpqudQHgU4VE/UJ/iQ0JN9GOS+EAX94TT6+1gH8s2c4rw0g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAGN/iWdIKo0tbE1c3ku7PeIYQgmNG+tqyyexM+f0I3zAiEA0Om8U1wdFv5YcHUZgb85iNg48rP9Q3ItqZzy4wKM67w="}],"size":18407,"noattachment":false,"key":"/servie/-/servie-0.2.3.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/servie-0.2.3.tgz_1494001911085_0.3961961870081723"},"directories":{},"readme":"# ![Servie](https://cdn.rawgit.com/serviejs/servie/master/logo.svg)\n\n[![NPM version](https://img.shields.io/npm/v/servie.svg)](https://npmjs.org/package/servie)\n[![NPM downloads](https://img.shields.io/npm/dm/servie.svg)](https://npmjs.org/package/servie)\n[![Build status](https://img.shields.io/travis/serviejs/servie.svg)](https://travis-ci.org/serviejs/servie)\n[![Test coverage](https://img.shields.io/coveralls/serviejs/servie.svg)](https://coveralls.io/r/serviejs/servie?branch=master)\n[![Bundle size](https://img.shields.io/bundlephobia/minzip/servie.svg)](https://bundlephobia.com/result?p=servie)\n\n> Standard, framework-agnostic HTTP interfaces for JavaScript servers and clients.\n\n## Installation\n\n```\nnpm install servie --save\n```\n\n## Usage\n\n- [`throwback`](https://github.com/serviejs/throwback) Compose middleware functions into a single function\n- [`popsicle`](https://github.com/serviejs/popsicle) HTTP request library for node.js and browsers\n- [`servie-lambda`](https://github.com/serviejs/servie-lambda) Servie transport layer for AWS Lambda\n- [`servie-http`](https://github.com/serviejs/servie-http) Servie transport layer for node.js HTTP\n- [`get-body`](https://github.com/serviejs/get-body) General body parser for forms, JSON and text\n- [`servie-cors`](https://github.com/serviejs/servie-cors) CORS middleware for Servie\n- [`servie-route`](https://github.com/serviejs/servie-route) Routing middleware for Servie\n- [`servie-mount`](https://github.com/serviejs/servie-mount) Mount Servie middleware on a path prefix\n- [`servie-compat-http`](https://github.com/serviejs/servie-compat-http) Mimic node.js HTTP using Servie\n- [`servie-redirect`](https://github.com/serviejs/servie-redirect) Create response objects for redirection\n- [`servie-cookie-store`](https://github.com/serviejs/servie-cookie-store) API for managing client-side cookies\n- [`servie-errorhandler`](https://github.com/serviejs/servie-errorhandler) Standard error handler for transport layers\n- [`servie-finalhandler`](https://github.com/serviejs/servie-finalhandler) Standard final handler for transport layers\n- [`http-errors`](https://github.com/jshttp/http-errors) Create HTTP errors\n- [`boom`](https://github.com/hapijs/boom) HTTP-friendly error objects\n- [`consolidate`](https://github.com/tj/consolidate.js) Template rendering\n\n```ts\nimport { Body, Request, Response, Headers, AbortController } from \"servie\";\n```\n\n> Servie is a universal package, meaning node.js and browsers are supported without needing configuration. This means the primary endpoint requires some `dom` types in TypeScript. When in a node.js, or browser, only environment, prefer importing `servie/dist/{node,browser}` instead.\n\n### `Body`\n\n> Base HTTP class shared between `Request` and `Response`.\n\n```ts\nnew Body(body, headers);\n```\n\n#### Body\n\nSupported body types, depending on environment:\n\n- Node.js - `string | Buffer | ArrayBuffer | Readable | null | undefined`\n- Browser - `string | ArrayBuffer | ReadableStream | null | undefined`\n\n#### Properties and Methods\n\n- `bodyUsed` Boolean whether the body is already consumed\n- `text()` Returns the body as a `Promise<string>`\n- `json()` Returns the body with `JSON.parse` as `Promise<any>`\n- `arrayBuffer()` Returns the body as a `Promise<ArrayBuffer>`\n- `clone()` Clones an unconsumed body\n- `destroy()` Consumes and destroys the body\n\n### `Request`\n\n> HTTP class for modelling a `Request`, extends `Body`.\n\n```ts\nnew Request(input [, init]);\n```\n\n#### Input\n\nA URL string or another `Request` instance to clone from.\n\n#### Init\n\n- `method?` HTTP request method.\n- `body?` Any support body types.\n- `signal?` A signal from an `AbortController`.\n- `headers?` A map, list of tuples, or `Header` instance to initialize from.\n- `trailer?` A promise resolve to a support header initialization types (above).\n\n#### Properties and Methods\n\n- `url` Requested url string\n- `method` Requested method string\n- `signal` Signal event emitter\n- `headers` A [`Headers`](#headers) instance\n- `trailer` A [`Promise<Headers>`](#headers) instance\n- `clone()` Clones the request into a new instance\n\n### `Response`\n\n> HTTP class for modelling a `Response`, extends `Body`.\n\n```ts\nnew Response([body [, init]]);\n```\n\n#### Body\n\nOne of the support body types (above).\n\n#### Init\n\n- `status?` The numeric HTTP response status code\n- `statusText?` The HTTP response status text\n\n#### Properties and Methods\n\n- `status` The numeric HTTP response status code\n- `statusText` The HTTP response status text\n- `ok` Boolean indicates successful response (`status` between 200 and 299)\n- `headers` A [`Headers`](#headers) instance\n- `trailer` A [`Promise<Headers>`](#headers) instance\n- `clone()` Clones the response into a new instance\n\n### `Headers`\n\n> Map representation of HTTP headers.\n\n```ts\nnew Headers([init]);\n```\n\n#### Init\n\nInitialize headers from `Iterable<HeaderTuple>`, a `HeadersObject` or an existing `Headers` instance.\n\n#### Methods\n\n- `set(name: string, value: string | string[]): void` Set a HTTP header by overriding case-insensitive headers of the same name\n- `append(name: string, value: string | string[]): void` Append a HTTP header\n- `get(name: string): string | undefined` Retrieve a case-insensitive HTTP header\n- `getAll(name: string): string[]` Retrieve a list of matching case-insensitive HTTP headers\n- `has(name: string): boolean` Check if a case-insensitive header is already set\n- `delete(name: string): void` Delete a case-insensitive header\n- `asObject(): HeadersObject` Return the lower-cased headers as a plain object\n- `extend(obj: HeadersInit): this` Extends the current headers with an object\n- `keys()` Iterable of the available header names\n- `values()` Iterable of header values\n- `entries()` Iterable of headers as `[key, value]`\n- `clear()` Clears the headers instance\n- `clone()` Clones the `Headers` instance\n\n### `AbortController`\n\n> Simple controller for aborting a `Request` instance.\n\n```ts\nnew AbortController();\n```\n\n#### Properties and Methods\n\n- `signal` A [`Signal`](#signal) instance to pass to a [`Request`](#request)\n- `abort()` Used to abort any listening requests through the `signal`\n\n### `Signal`\n\n> Tiny [event emitter](https://github.com/serviejs/events) for communicating during a request.\n\n#### Methods\n\n- `aborted` Boolean indicating whether the request is aborted\n- `on(type, fn)` Attach an event listener to an event type\n- `off(type, fn)` Remove an event listener from an event type\n- `each(fn)` Attach an event listener for all events\n- `none(fn)` Remove a global event listener\n- `emit(type, ...args)` Emit an event to all listeners\n\n#### Standard Events\n\n- `abort` The request has been aborted\n- `requestBytes` Emitted on request progress with current bytes\n- `requestEnded` The request has ended\n- `requestStarted` The request has been started\n- `responseBytes` Emitted on response progress with current bytes\n- `responseEnded` The response has ended\n- `responseStarted` The response has started\n\nPlugins can emit new types of events.\n\n## Implementation\n\nIf you're building the transports for Servie, there are some life cycle events you need to be aware of:\n\n1. Listen to the `error` event on `signal` for errors\n2. Listen to the `abort` event on `signal` to destroy the connection\n3. Resolve `trailer` promise and append to HTTP request or response\n4. There are some existing built-in type-safe events in `SignalEvents` you can support\n\n## JavaScript\n\nThis module is designed for ES2017 environments and published with [TypeScript](https://github.com/Microsoft/TypeScript) definitions on NPM.\n\n## License\n\nApache 2.0\n","publish_time":1494001913124,"_cnpm_publish_time":1494001913124,"dist-tags":{"latest":"4.3.3"}}