Is "not_found" function not available?
koji-k opened this issue · comments
koji commented
I cloned this opium repository.
and executed build (cd examples; dune build @examples
)
No problem.
Then i started to create a new sample opium project.(to lean this framework)
- create a new directory.
- create dune file
- create hello_world.ml
dune
(executables
(libraries re ezjsonm opium logs.fmt opium_kernel)
(preprocess
(pps ppx_sexp_conv))
(flags
(:standard -safe-string))
(names hello_world))
(alias
(name examples)
(deps hello_world.exe))
hello_world.ml
open Opium.Std
let hello =
get "/hello/" (fun _req ->
`String ("Hello") |> respond')
let default =
not_found (fun _req ->
`Json Ezjsonm.(dict [("message", string "Route not found")]) |> respond')
let _ = App.empty |> default
|> App.run_command
Then executed dune build hello_world.exe
But i got a following error at this time.
[koji:hello_opium]$ dune build hello_world.exe
File "hello_world.ml", line 8, characters 2-11:
8 | not_found (fun _req ->
^^^^^^^^^
Error: Unbound value not_found
[koji:hello_opium]$
Is this expected behavior?
Is not_found
function available only by example?
Anurag Soni commented
the not_found
function was added recently and its not available on the version published on the opam registry. You can access it if you pin opium and opium_kernel to thee version in this repository.
opam pin add opium_kernel.dev --dev-repo
opam pin add opium.dev --dev-repo
koji commented
Thank you very much for your quickly helpful answer!
I could understand the situation.
Anurag Soni commented
You are welcome!