Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cohttp-eio server #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions bin/dune

This file was deleted.

36 changes: 0 additions & 36 deletions bin/main.ml

This file was deleted.

3 changes: 3 additions & 0 deletions dune
@@ -0,0 +1,3 @@
(executable
(name server)
(libraries cohttp-eio eio_main))
7 changes: 2 additions & 5 deletions dune-project
Expand Up @@ -17,10 +17,7 @@

(package
(name ocaml_http)
(allow_empty)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune)
(tags
(topics "to describe" your project)))

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
(depends cohttp-eio eio_main))
2 changes: 0 additions & 2 deletions lib/dune

This file was deleted.

4 changes: 2 additions & 2 deletions ocaml_http.opam
Expand Up @@ -5,13 +5,13 @@ description: "A longer description"
maintainer: ["Maintainer Name"]
authors: ["Author Name"]
license: "LICENSE"
tags: ["topics" "to describe" "your" "project"]
homepage: "https://github.com/username/reponame"
doc: "https://url/to/documentation"
bug-reports: "https://github.com/username/reponame/issues"
depends: [
"ocaml"
"dune" {>= "3.11"}
"cohttp-eio"
"eio_main"
"odoc" {with-doc}
]
build: [
Expand Down
9 changes: 9 additions & 0 deletions server.ml
@@ -0,0 +1,9 @@
open Cohttp_eio

let app (req, _, _) = match Http.Request.resource req with
| "/hi" -> Server.html_response "hi"
| _ -> Server.not_found_response

let () =
Eio_main.run @@ fun env ->
Server.run ~port:8080 ~domains:(Domain.recommended_domain_count ()) env app
2 changes: 0 additions & 2 deletions test/dune

This file was deleted.

Empty file removed test/ocaml_http.ml
Empty file.