tink_http 0.7.0

Universal HTTP abstraction

Released 2017-03-28.

To install, run:

haxelib install tink_http 0.7.0

See using Haxelib in Haxelib documentation for more information.

Maintainerback2dos
Websitehttp://haxetink.org/tink_http
Current version0.7.0
StatisticsInstalled 1394 times
LicenseMIT
Tags cross, http, tink

README.md

Tink HTTP

Gitter

Client

// pick a client of your choice (see tink.http.Client)
var client:Client = ...;

// construct your request
var request:OutgoingRequest = ...;

client.request(request).handle(function(response) {
	// handle the response here
	trace(response);
});

Handler

Handler is just a function that takes in a request and return a future response.

typedef Handler = IncomingRequest->Future<OutgoingResponse>

Container

// prepare your handler
var handler:Handler = ...;

// pick a container of your choice (see tink.http.containers.*)
var container:Container = ...;

// start the container
container.run(handler).handle(function(result) switch result {
	case Running(running):
		// for persistent servers like NodeJS. Use running.shutdown() to shutdown the server.
	case Done;
		// for CGI-like environments like mod_neko or php
	case Failed(e):
		// something's wrong
});

Multipart

Todo...

Middleware

Todo...