Created
November 10, 2013 20:03
-
-
Save ericbmerritt/7403158 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: This expression has type | |
string Async.Std.Pipe.Reader.t option -> | |
Async.Std.Socket.Address.Inet.t -> | |
Cohttp_async.Request.t -> | |
Cohttp_async.Server.response Async.Std.Deferred.t | |
but an expression was expected of type | |
body:string Async.Std.Pipe.Reader.t option -> | |
Async.Std.Socket.Address.Inet.t -> | |
Cohttp_async.Request.t -> | |
Cohttp_async.Server.response Async.Std.Deferred.t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Core.Std | |
open Async.Std | |
open Async_extra | |
open Cohttp | |
open Cohttp_async | |
let where_to_listen = | |
Tcp.Where_to_listen.create | |
~socket_type:Socket.Type.tcp | |
~address:(Socket.Address.Inet.create_bind_any ~port:4566) | |
~listening_on:(fun (`Inet (_, port)) -> port) | |
let server (body:string Pipe.Reader.t option) (address:Socket.Address.Inet.t) (req:Cohttp_async.Request.t) = Server.respond_with_string ~headers:(Header.init ()) ~code:(`Code 200) "foo" | |
let () = | |
Server.create ~max_connections:10 ~max_pending_connections:10 ~on_handler_error:`Raise | |
where_to_listen server; | |
never_returns (Scheduler.go ()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment