This commit is contained in:
Kaustubh Maske Patil 2025-05-08 11:26:25 +05:30
parent 73f68e201f
commit 2e4779cc96
11 changed files with 118 additions and 106 deletions

View File

@ -1,4 +1,5 @@
(executables (executables
(names nikodream) (names nikodream)
(public_names nkd) (public_names nkd)
(libraries dream)) (libraries dream)
(preprocess (pps lwt_ppx)))

View File

@ -1,9 +1,18 @@
let count = ref 0 open Lwt.Syntax
let successful = ref 0
let failed = ref 0
(* middleware *) (* middleware *)
let count_requests inner_handler request = let count_requests inner_handler request =
count := !count + 1; try%lwt
inner_handler request let* response = inner_handler request in
successful := !successful + 1;
Lwt.return response
with exn ->
failed := !failed + 1;
raise exn
let () = let () =
Dream.run Dream.run
@ -16,7 +25,7 @@ let () =
Dream.get "/count" Dream.get "/count"
(fun _ -> (fun _ ->
Dream.html (Printf.sprintf "Saw %i requests" !count)); Dream.html (Printf.sprintf "%3i successful requests<br>%3i failed requests" !successful !failed));
Dream.get "/echo/:word" Dream.get "/echo/:word"
(fun request -> (fun request ->

115
esy.lock/index.json generated
View File

@ -1,6 +1,6 @@
{ {
"checksum": "a0412524db59e59aebb24509edd835dc", "checksum": "e4ee4b7714a5bd5269a68329dbbf5ec1",
"root": "dream.kaustubh.page@link-dev:./package.json", "root": "nikodream@link-dev:./package.json",
"node": { "node": {
"ocaml@5.2.0@d41d8cd9": { "ocaml@5.2.0@d41d8cd9": {
"id": "ocaml@5.2.0@d41d8cd9", "id": "ocaml@5.2.0@d41d8cd9",
@ -16,6 +16,27 @@
"dependencies": [], "dependencies": [],
"devDependencies": [] "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": { "esy-pkg-config@0.29.2002@d41d8cd9": {
"id": "esy-pkg-config@0.29.2002@d41d8cd9", "id": "esy-pkg-config@0.29.2002@d41d8cd9",
"name": "esy-pkg-config", "name": "esy-pkg-config",
@ -75,26 +96,6 @@
"dependencies": [], "dependencies": [],
"devDependencies": [] "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": { "@opam/zarith@opam:1.14@96388393": {
"id": "@opam/zarith@opam:1.14@96388393", "id": "@opam/zarith@opam:1.14@96388393",
"name": "@opam/zarith", "name": "@opam/zarith",
@ -2426,23 +2427,23 @@
], ],
"available": "true" "available": "true"
}, },
"@opam/host-arch-x86_64@opam:1@061769f7": { "@opam/host-arch-x86_32@opam:1@a8842e10": {
"id": "@opam/host-arch-x86_64@opam:1@061769f7", "id": "@opam/host-arch-x86_32@opam:1@a8842e10",
"name": "@opam/host-arch-x86_64", "name": "@opam/host-arch-x86_32",
"version": "opam:1", "version": "opam:1",
"source": { "source": {
"type": "install", "type": "install",
"source": [ "no-source:" ], "source": [ "no-source:" ],
"opam": { "opam": {
"name": "host-arch-x86_64", "name": "host-arch-x86_32",
"version": "1", "version": "1",
"path": "esy.lock/opam/host-arch-x86_64.1" "path": "esy.lock/opam/host-arch-x86_32.1"
} }
}, },
"overrides": [], "overrides": [],
"dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "dependencies": [ "@esy-ocaml/substs@0.0.1@d41d8cd9" ],
"devDependencies": [], "devDependencies": [],
"available": "os = \"win32\" | arch = \"x86_64\"" "available": "os = \"win32\" | arch = \"x86_32\""
}, },
"@opam/hmap@opam:0.8.1@11743a50": { "@opam/hmap@opam:0.8.1@11743a50": {
"id": "@opam/hmap@opam:0.8.1@11743a50", "id": "@opam/hmap@opam:0.8.1@11743a50",
@ -3409,39 +3410,39 @@
], ],
"dependencies": [ "dependencies": [
"esy-pkg-config@0.29.2002@d41d8cd9", "esy-pkg-config@0.29.2002@d41d8cd9",
"@opam/host-arch-x86_64@opam:1@061769f7", "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b", "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6",
"@esy-ocaml/substs@0.0.1@d41d8cd9" "@esy-ocaml/substs@0.0.1@d41d8cd9"
], ],
"devDependencies": [ "devDependencies": [
"@opam/host-arch-x86_64@opam:1@061769f7", "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b" "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6"
], ],
"available": "true" "available": "true"
}, },
"@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b": { "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6": {
"id": "@opam/conf-mingw-w64-pkgconf-x86_64@opam:1@40c35c0b", "id": "@opam/conf-mingw-w64-pkgconf-i686@opam:1@b00fffb6",
"name": "@opam/conf-mingw-w64-pkgconf-x86_64", "name": "@opam/conf-mingw-w64-pkgconf-i686",
"version": "opam:1", "version": "opam:1",
"source": { "source": {
"type": "install", "type": "install",
"source": [ "no-source:" ], "source": [ "no-source:" ],
"opam": { "opam": {
"name": "conf-mingw-w64-pkgconf-x86_64", "name": "conf-mingw-w64-pkgconf-i686",
"version": "1", "version": "1",
"path": "esy.lock/opam/conf-mingw-w64-pkgconf-x86_64.1" "path": "esy.lock/opam/conf-mingw-w64-pkgconf-i686.1"
} }
}, },
"overrides": [ "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": [ "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" "@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\"" "available": "os = \"win32\""
}, },
"@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6": { "@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6": {
@ -3496,32 +3497,32 @@
"devDependencies": [], "devDependencies": [],
"available": "os = \"win32\"" "available": "os = \"win32\""
}, },
"@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13": { "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36": {
"id": "@opam/conf-mingw-w64-gmp-x86_64@opam:1@8bc14e13", "id": "@opam/conf-mingw-w64-gmp-i686@opam:1@6e7a0f36",
"name": "@opam/conf-mingw-w64-gmp-x86_64", "name": "@opam/conf-mingw-w64-gmp-i686",
"version": "opam:1", "version": "opam:1",
"source": { "source": {
"type": "install", "type": "install",
"source": [ "no-source:" ], "source": [ "no-source:" ],
"opam": { "opam": {
"name": "conf-mingw-w64-gmp-x86_64", "name": "conf-mingw-w64-gmp-i686",
"version": "1", "version": "1",
"path": "esy.lock/opam/conf-mingw-w64-gmp-x86_64.1" "path": "esy.lock/opam/conf-mingw-w64-gmp-i686.1"
} }
}, },
"overrides": [ "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": [ "dependencies": [
"@opam/msys2-mingw64@opam:1@87757bbf", "@opam/msys2-mingw32@opam:1@3e920f82",
"@opam/msys2@opam:0.1.0@9a30ef2c", "@opam/msys2@opam:0.1.0@9a30ef2c",
"@opam/conf-pkg-config@opam:4@04531507", "@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" "@esy-ocaml/substs@0.0.1@d41d8cd9"
], ],
"devDependencies": [ "@opam/msys2-mingw64@opam:1@87757bbf" ], "devDependencies": [ "@opam/msys2-mingw32@opam:1@3e920f82" ],
"available": "os = \"win32\"" "available": "os = \"win32\""
}, },
"@opam/conf-mingw-w64-gcc-x86_64@opam:1@f0bd8247": { "@opam/conf-mingw-w64-gcc-x86_64@opam:1@f0bd8247": {
@ -3594,14 +3595,14 @@
], ],
"dependencies": [ "dependencies": [
"esy-openssl@archive:https://www.openssl.org/source/openssl-1.1.1l.tar.gz#sha256:0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1@d2b1c9f1", "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-pkg-config@opam:4@04531507",
"@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6", "@opam/conf-mingw-w64-openssl-x86_64@opam:1@01c642e6",
"@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84", "@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84",
"@esy-ocaml/substs@0.0.1@d41d8cd9" "@esy-ocaml/substs@0.0.1@d41d8cd9"
], ],
"devDependencies": [ "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-x86_64@opam:1@01c642e6",
"@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84" "@opam/conf-mingw-w64-openssl-i686@opam:1@14f02e84"
], ],
@ -3633,11 +3634,11 @@
} }
], ],
"dependencies": [ "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" "@opam/conf-gmp@opam:5@3eae9750", "@esy-ocaml/substs@0.0.1@d41d8cd9"
], ],
"devDependencies": [ "devDependencies": [
"@opam/host-arch-x86_64@opam:1@061769f7", "@opam/host-arch-x86_32@opam:1@a8842e10",
"@opam/conf-gmp@opam:5@3eae9750" "@opam/conf-gmp@opam:5@3eae9750"
], ],
"extraSources": [ "extraSources": [
@ -3668,15 +3669,15 @@
} }
], ],
"dependencies": [ "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-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" "@esy-ocaml/substs@0.0.1@d41d8cd9"
], ],
"devDependencies": [ "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-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": [ "extraSources": [
{ {

View File

@ -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 <david@tarides.com>"
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"}
]

View File

@ -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 <david@tarides.com>"
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"}
]

View File

@ -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 <david@tarides.com>"
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"}
]

View File

@ -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 <david@tarides.com>"
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"}
]

View File

@ -1,10 +1,10 @@
opam-version: "2.0" opam-version: "2.0"
synopsis: "OCaml on amd64 (64-bit)" synopsis: "OCaml on x86 (32-bit)"
description: """ description: """
This package is installed if the underlying OCaml compiler is for 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 This package may be used in depends or conflicts fields of dependent packages
to indicate either a requirement or an incompatibility with this 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" conflict-class: "ocaml-host-arch"
# Temporary, while these packages are not being installed by the compilers on # Temporary, while these packages are not being installed by the compilers on
# non-Windows builds. # non-Windows builds.
available: os = "win32" | arch = "x86_64" available: os = "win32" | arch = "x86_32"

View File

@ -9,6 +9,7 @@
"dependencies": { "dependencies": {
"@opam/dream": "1.0.0~alpha7", "@opam/dream": "1.0.0~alpha7",
"@opam/dune": "*", "@opam/dune": "*",
"@opam/lwt": "5.9.1",
"ocaml": "5.2" "ocaml": "5.2"
}, },
"devDependencies": { "devDependencies": {
@ -16,4 +17,4 @@
"@opam/ocaml-lsp-server": "1.21.0", "@opam/ocaml-lsp-server": "1.21.0",
"@opam/ocamlformat": "0.27.0" "@opam/ocamlformat": "0.27.0"
} }
} }