diff --git a/bin/dune b/bin/dune
index 30fe35f..3b8b076 100644
--- a/bin/dune
+++ b/bin/dune
@@ -1,4 +1,5 @@
(executables
(names nikodream)
(public_names nkd)
- (libraries dream))
+ (libraries dream)
+ (preprocess (pps lwt_ppx)))
diff --git a/bin/nikodream.ml b/bin/nikodream.ml
index c7f166a..ad4b989 100644
--- a/bin/nikodream.ml
+++ b/bin/nikodream.ml
@@ -1,9 +1,18 @@
-let count = ref 0
+open Lwt.Syntax
+
+let successful = ref 0
+let failed = ref 0
(* middleware *)
let count_requests inner_handler request =
- count := !count + 1;
- inner_handler request
+ try%lwt
+ let* response = inner_handler request in
+ successful := !successful + 1;
+ Lwt.return response
+
+ with exn ->
+ failed := !failed + 1;
+ raise exn
let () =
Dream.run
@@ -16,7 +25,7 @@ let () =
Dream.get "/count"
(fun _ ->
- Dream.html (Printf.sprintf "Saw %i requests" !count));
+ Dream.html (Printf.sprintf "%3i successful requests
%3i failed requests" !successful !failed));
Dream.get "/echo/:word"
(fun request ->
diff --git a/esy.lock/index.json b/esy.lock/index.json
index 700e779..8b18fd7 100644
--- a/esy.lock/index.json
+++ b/esy.lock/index.json
@@ -1,6 +1,6 @@
{
- "checksum": "a0412524db59e59aebb24509edd835dc",
- "root": "dream.kaustubh.page@link-dev:./package.json",
+ "checksum": "e4ee4b7714a5bd5269a68329dbbf5ec1",
+ "root": "nikodream@link-dev:./package.json",
"node": {
"ocaml@5.2.0@d41d8cd9": {
"id": "ocaml@5.2.0@d41d8cd9",
@@ -16,6 +16,27 @@
"dependencies": [],
"devDependencies": []
},
+ "nikodream@link-dev:./package.json": {
+ "id": "nikodream@link-dev:./package.json",
+ "name": "nikodream",
+ "version": "link-dev:./package.json",
+ "source": {
+ "type": "link-dev",
+ "path": ".",
+ "manifest": "package.json"
+ },
+ "overrides": [],
+ "dependencies": [
+ "ocaml@5.2.0@d41d8cd9", "@opam/lwt@opam:5.9.1@14776079",
+ "@opam/dune@opam:3.18.2@22ffdaaa",
+ "@opam/dream@opam:1.0.0~alpha7@2203059e"
+ ],
+ "devDependencies": [
+ "@opam/ocamlformat@opam:0.27.0@6c2dc1c8",
+ "@opam/ocaml-lsp-server@opam:1.21.0@3b310a8b",
+ "@opam/merlin@opam:5.3-502@3e874b7d"
+ ]
+ },
"esy-pkg-config@0.29.2002@d41d8cd9": {
"id": "esy-pkg-config@0.29.2002@d41d8cd9",
"name": "esy-pkg-config",
@@ -75,26 +96,6 @@
"dependencies": [],
"devDependencies": []
},
- "dream.kaustubh.page@link-dev:./package.json": {
- "id": "dream.kaustubh.page@link-dev:./package.json",
- "name": "dream.kaustubh.page",
- "version": "link-dev:./package.json",
- "source": {
- "type": "link-dev",
- "path": ".",
- "manifest": "package.json"
- },
- "overrides": [],
- "dependencies": [
- "ocaml@5.2.0@d41d8cd9", "@opam/dune@opam:3.18.2@22ffdaaa",
- "@opam/dream@opam:1.0.0~alpha7@2203059e"
- ],
- "devDependencies": [
- "@opam/ocamlformat@opam:0.27.0@6c2dc1c8",
- "@opam/ocaml-lsp-server@opam:1.21.0@3b310a8b",
- "@opam/merlin@opam:5.3-502@3e874b7d"
- ]
- },
"@opam/zarith@opam:1.14@96388393": {
"id": "@opam/zarith@opam:1.14@96388393",
"name": "@opam/zarith",
@@ -2426,23 +2427,23 @@
],
"available": "true"
},
- "@opam/host-arch-x86_64@opam:1@061769f7": {
- "id": "@opam/host-arch-x86_64@opam:1@061769f7",
- "name": "@opam/host-arch-x86_64",
+ "@opam/host-arch-x86_32@opam:1@a8842e10": {
+ "id": "@opam/host-arch-x86_32@opam:1@a8842e10",
+ "name": "@opam/host-arch-x86_32",
"version": "opam:1",
"source": {
"type": "install",
"source": [ "no-source:" ],
"opam": {
- "name": "host-arch-x86_64",
+ "name": "host-arch-x86_32",
"version": "1",
- "path": "esy.lock/opam/host-arch-x86_64.1"
+ "path": "esy.lock/opam/host-arch-x86_32.1"
}
},
"overrides": [],
"dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ],
"devDependencies": [],
- "available": "os = \"win32\" | arch = \"x86_64\""
+ "available": "os = \"win32\" | arch = \"x86_32\""
},
"@opam/hmap@opam:0.8.1@11743a50": {
"id": "@opam/hmap@opam:0.8.1@11743a50",
@@ -3409,39 +3410,39 @@
],
"dependencies": [
"esy-pkg-config@0.29.2002@d41d8cd9",
- "@opam/host-arch-x86_64@opam:1@061769f7",
- "@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
+ "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6",
"@esy-ocaml/substs@0.0.1@d41d8cd9"
],
"devDependencies": [
- "@opam/host-arch-x86_64@opam:1@061769f7",
- "@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b"
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
+ "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6"
],
"available": "true"
},
- "@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b": {
- "id": "@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b",
- "name": "@opam/conf-mingw-w64-pkgconf-x86_64",
+ "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6": {
+ "id": "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6",
+ "name": "@opam/conf-mingw-w64-pkgconf-i686",
"version": "opam:1",
"source": {
"type": "install",
"source": [ "no-source:" ],
"opam": {
- "name": "conf-mingw-w64-pkgconf-x86_64",
+ "name": "conf-mingw-w64-pkgconf-i686",
"version": "1",
- "path": "esy.lock/opam/conf-mingw-w64-pkgconf-x86_64.1"
+ "path": "esy.lock/opam/conf-mingw-w64-pkgconf-i686.1"
}
},
"overrides": [
{
- "opamoverride": "esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_x86__64_opam__c__1_opam_override"
+ "opamoverride": "esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_i686_opam__c__1_opam_override"
}
],
"dependencies": [
- "@opam/msys2-mingw64@opam:1@87757bbf",
+ "@opam/msys2-mingw32@opam:1@3e920f82",
"@opam/msys2@opam:0.1.0@9a30ef2c", "@esy-ocaml/substs@0.0.1@d41d8cd9"
],
- "devDependencies": [ "@opam/msys2-mingw64@opam:1@87757bbf" ],
+ "devDependencies": [ "@opam/msys2-mingw32@opam:1@3e920f82" ],
"available": "os = \"win32\""
},
"@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6": {
@@ -3496,32 +3497,32 @@
"devDependencies": [],
"available": "os = \"win32\""
},
- "@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13": {
- "id": "@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13",
- "name": "@opam/conf-mingw-w64-gmp-x86_64",
+ "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36": {
+ "id": "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36",
+ "name": "@opam/conf-mingw-w64-gmp-i686",
"version": "opam:1",
"source": {
"type": "install",
"source": [ "no-source:" ],
"opam": {
- "name": "conf-mingw-w64-gmp-x86_64",
+ "name": "conf-mingw-w64-gmp-i686",
"version": "1",
- "path": "esy.lock/opam/conf-mingw-w64-gmp-x86_64.1"
+ "path": "esy.lock/opam/conf-mingw-w64-gmp-i686.1"
}
},
"overrides": [
{
- "opamoverride": "esy.lock/overrides/opam__s__conf_mingw_w64_gmp_x86__64_opam__c__1_opam_override"
+ "opamoverride": "esy.lock/overrides/opam__s__conf_mingw_w64_gmp_i686_opam__c__1_opam_override"
}
],
"dependencies": [
- "@opam/msys2-mingw64@opam:1@87757bbf",
+ "@opam/msys2-mingw32@opam:1@3e920f82",
"@opam/msys2@opam:0.1.0@9a30ef2c",
"@opam/conf-pkg-config@opam:4@04531507",
- "@opam/conf-mingw-w64-gcc-x86_64@opam:1@f0bd8247",
+ "@opam/conf-mingw-w64-gcc-i686@opam:1@19472ef7",
"@esy-ocaml/substs@0.0.1@d41d8cd9"
],
- "devDependencies": [ "@opam/msys2-mingw64@opam:1@87757bbf" ],
+ "devDependencies": [ "@opam/msys2-mingw32@opam:1@3e920f82" ],
"available": "os = \"win32\""
},
"@opam/conf-mingw-w64-gcc-x86_64@opam:1@f0bd8247": {
@@ -3594,14 +3595,14 @@
],
"dependencies": [
"esy-openssl@archive:https://www.openssl.org/source/openssl-1.1.1l.tar.gz#sha256:0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1@d2b1c9f1",
- "@opam/host-arch-x86_64@opam:1@061769f7",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-pkg-config@opam:4@04531507",
"@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6",
"@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84",
"@esy-ocaml/substs@0.0.1@d41d8cd9"
],
"devDependencies": [
- "@opam/host-arch-x86_64@opam:1@061769f7",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6",
"@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84"
],
@@ -3633,11 +3634,11 @@
}
],
"dependencies": [
- "@opam/host-arch-x86_64@opam:1@061769f7",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-gmp@opam:5@3eae9750", "@esy-ocaml/substs@0.0.1@d41d8cd9"
],
"devDependencies": [
- "@opam/host-arch-x86_64@opam:1@061769f7",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-gmp@opam:5@3eae9750"
],
"extraSources": [
@@ -3668,15 +3669,15 @@
}
],
"dependencies": [
- "esy-gmp@6.3.0@d41d8cd9", "@opam/host-arch-x86_64@opam:1@061769f7",
+ "esy-gmp@6.3.0@d41d8cd9", "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-pkg-config@opam:4@04531507",
- "@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13",
+ "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36",
"@esy-ocaml/substs@0.0.1@d41d8cd9"
],
"devDependencies": [
- "@opam/host-arch-x86_64@opam:1@061769f7",
+ "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-pkg-config@opam:4@04531507",
- "@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13"
+ "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36"
],
"extraSources": [
{
diff --git a/esy.lock/opam/conf-mingw-w64-gmp-i686.1/opam b/esy.lock/opam/conf-mingw-w64-gmp-i686.1/opam
new file mode 100644
index 0000000..732c20b
--- /dev/null
+++ b/esy.lock/opam/conf-mingw-w64-gmp-i686.1/opam
@@ -0,0 +1,21 @@
+opam-version: "2.0"
+synopsis: "Virtual package for libgmp on i686 mingw-w64 (32-bit x86)"
+description: "Ensures the i686 version of libgmp for the mingw-w64 project is available"
+maintainer: "David Allsopp "
+authors: "Torbjörn Granlund et al"
+license: "GPL-1.0-or-later"
+homepage: "http://gmplib.org/"
+bug-reports: "https://github.com/ocaml/opam-repository/issues"
+flags: conf
+available: os = "win32"
+build: ["pkgconf" "--personality=i686-w64-mingw32" {os-distribution = "cygwin"} "gmp"]
+depends: [
+ "msys2" {build & os = "win32" & os-distribution = "msys2"}
+ "msys2-mingw32" {os = "win32" & os-distribution = "msys2"}
+ "conf-pkg-config" {build}
+ "conf-mingw-w64-gcc-i686" {build}
+]
+depexts: [
+ ["mingw64-i686-gmp"] {os = "win32" & os-distribution = "cygwin"}
+ ["mingw-w64-i686-gmp"] {os = "win32" & os-distribution = "msys2"}
+]
diff --git a/esy.lock/opam/conf-mingw-w64-gmp-x86_64.1/opam b/esy.lock/opam/conf-mingw-w64-gmp-x86_64.1/opam
deleted file mode 100644
index b068464..0000000
--- a/esy.lock/opam/conf-mingw-w64-gmp-x86_64.1/opam
+++ /dev/null
@@ -1,21 +0,0 @@
-opam-version: "2.0"
-synopsis: "Virtual package for libgmp on x86_64 mingw-w64 (64-bit x86_64)"
-description: "Ensures the x86_64 version of libgmp for the mingw-w64 project is available"
-maintainer: "David Allsopp "
-authors: "Torbjörn Granlund et al"
-license: "GPL-1.0-or-later"
-homepage: "http://gmplib.org/"
-bug-reports: "https://github.com/ocaml/opam-repository/issues"
-flags: conf
-available: os = "win32"
-build: ["pkgconf" "--personality=x86_64-w64-mingw32" {os-distribution = "cygwin"} "gmp"]
-depends: [
- "msys2" {build & os = "win32" & os-distribution = "msys2"}
- "msys2-mingw64" {os = "win32" & os-distribution = "msys2"}
- "conf-pkg-config" {build}
- "conf-mingw-w64-gcc-x86_64" {build}
-]
-depexts: [
- ["mingw64-x86_64-gmp"] {os = "win32" & os-distribution = "cygwin"}
- ["mingw-w64-x86_64-gmp"] {os = "win32" & os-distribution = "msys2"}
-]
diff --git a/esy.lock/opam/conf-mingw-w64-pkgconf-i686.1/opam b/esy.lock/opam/conf-mingw-w64-pkgconf-i686.1/opam
new file mode 100644
index 0000000..fe698a4
--- /dev/null
+++ b/esy.lock/opam/conf-mingw-w64-pkgconf-i686.1/opam
@@ -0,0 +1,18 @@
+opam-version: "2.0"
+synopsis: "Virtual package for pkgconf on i686 mingw-w64 (32-bit x86)"
+description: "Ensures the i686 version of pkgconf for the mingw-w64 project is available"
+maintainer: "David Allsopp "
+authors: "Ariadne Conill et al"
+license: "ISC"
+homepage: "http://pkgconf.org"
+bug-reports: "https://github.com/ocaml/opam-repository/issues"
+flags: conf
+available: os = "win32"
+depends: [
+ "msys2" {build & os = "win32" & os-distribution = "msys2"}
+ "msys2-mingw32" {os = "win32" & os-distribution = "msys2"}
+]
+build: ["i686-w64-mingw32-pkgconf" "--version"]
+depexts: [
+ ["mingw-w64-i686-pkgconf"] {os = "win32" & os-distribution = "msys2"}
+]
diff --git a/esy.lock/opam/conf-mingw-w64-pkgconf-x86_64.1/opam b/esy.lock/opam/conf-mingw-w64-pkgconf-x86_64.1/opam
deleted file mode 100644
index 5ea60fb..0000000
--- a/esy.lock/opam/conf-mingw-w64-pkgconf-x86_64.1/opam
+++ /dev/null
@@ -1,18 +0,0 @@
-opam-version: "2.0"
-synopsis: "Virtual package for pkgconf on x86_64 mingw-w64 (64-bit x86_64)"
-description: "Ensures the x86_64 version of pkgconf for the mingw-w64 project is available"
-maintainer: "David Allsopp "
-authors: "Ariadne Conill et al"
-license: "ISC"
-homepage: "http://pkgconf.org"
-bug-reports: "https://github.com/ocaml/opam-repository/issues"
-flags: conf
-available: os = "win32"
-depends: [
- "msys2" {build & os = "win32" & os-distribution = "msys2"}
- "msys2-mingw64" {os = "win32" & os-distribution = "msys2"}
-]
-build: ["x86_64-w64-mingw32-pkgconf" "--version"]
-depexts: [
- ["mingw-w64-x86_64-pkgconf"] {os = "win32" & os-distribution = "msys2"}
-]
diff --git a/esy.lock/opam/host-arch-x86_64.1/opam b/esy.lock/opam/host-arch-x86_32.1/opam
similarity index 83%
rename from esy.lock/opam/host-arch-x86_64.1/opam
rename to esy.lock/opam/host-arch-x86_32.1/opam
index 4d52d55..ff6b64a 100644
--- a/esy.lock/opam/host-arch-x86_64.1/opam
+++ b/esy.lock/opam/host-arch-x86_32.1/opam
@@ -1,10 +1,10 @@
opam-version: "2.0"
-synopsis: "OCaml on amd64 (64-bit)"
+synopsis: "OCaml on x86 (32-bit)"
description: """
This package is installed if the underlying OCaml compiler is for
-64-bit Intel x86 (x86_64/amd64/x64).
+32-bit Intel x86 (x86_32/x86).
-Precisely, this means `ocamlopt -config-var architecture` equals `amd64`.
+Precisely, this means `ocamlopt -config-var architecture` equals `i386`.
This package may be used in depends or conflicts fields of dependent packages
to indicate either a requirement or an incompatibility with this
@@ -17,4 +17,4 @@ bug-reports: "https://github.com/ocaml/opam-repository/issues"
conflict-class: "ocaml-host-arch"
# Temporary, while these packages are not being installed by the compilers on
# non-Windows builds.
-available: os = "win32" | arch = "x86_64"
+available: os = "win32" | arch = "x86_32"
diff --git a/esy.lock/overrides/opam__s__conf_mingw_w64_gmp_x86__64_opam__c__1_opam_override/package.json b/esy.lock/overrides/opam__s__conf_mingw_w64_gmp_i686_opam__c__1_opam_override/package.json
similarity index 100%
rename from esy.lock/overrides/opam__s__conf_mingw_w64_gmp_x86__64_opam__c__1_opam_override/package.json
rename to esy.lock/overrides/opam__s__conf_mingw_w64_gmp_i686_opam__c__1_opam_override/package.json
diff --git a/esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_x86__64_opam__c__1_opam_override/package.json b/esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_i686_opam__c__1_opam_override/package.json
similarity index 100%
rename from esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_x86__64_opam__c__1_opam_override/package.json
rename to esy.lock/overrides/opam__s__conf_mingw_w64_pkgconf_i686_opam__c__1_opam_override/package.json
diff --git a/package.json b/package.json
index 0c36ba9..e98c074 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"dependencies": {
"@opam/dream": "1.0.0~alpha7",
"@opam/dune": "*",
+ "@opam/lwt": "5.9.1",
"ocaml": "5.2"
},
"devDependencies": {
@@ -16,4 +17,4 @@
"@opam/ocaml-lsp-server": "1.21.0",
"@opam/ocamlformat": "0.27.0"
}
-}
+}
\ No newline at end of file