0.7.13 • Published 7 years ago

funkster-http-headers-accept v0.7.13

Weekly downloads
6
License
Unlicense
Repository
github
Last release
7 years ago

funkster-http-headers-accept

npm node npm Travis

Icon

Funkster is a compositional server library. This package contains combinators and types to parse the HTTP Accept* headers of a request.

Additional examples of how to build HTTP server apis with funkster can be found here.

Typscript is used to illustrate the examples.

Install

$ npm install funkster-http-headers-accept

Build

$ npm install && npm run build

Test

$ npm run test

Parsing the Accept* headers from a request

This module uses the accepts package so essentially the same api applies for the parsed headers object.

import * as http from 'http';
import { parseAcceptHeaders } from 'funkster-http-headers-accept';
import { asRequestListener, Ok } from 'funkster-http';

const pipe = parseAcceptHeaders(headers => Ok(headers.type('json')));
const server = http.createServer(asRequestListener(pipe));

// start the node HTTP server and send e.g. a GET with the Accept header set to 'application/json'.

Meta

Icon funky by iconsmind.com from the Noun Project.

0.7.13

7 years ago

0.7.12

7 years ago

0.7.11

7 years ago

0.7.10

7 years ago

0.7.9

7 years ago

0.7.8

7 years ago

0.7.7

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.4

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago