I am playing with Ocsigen at the moment familiarising myself with the architecture and practices of using this web framework. A web-site is smoothly generated with ocsigen-start 2.16.1 in OCaml 4.10.0. Unfortunately, I got stuck with a very basic change I did on this fresh web-site, and at the moment I run out of ideas and knowledge.
ocsigen-start has so called “main_service” created in “os_services.eliom”, (actually, its compiled library installed by opam, but in this post I’ll be referring to the source code)
let%server main_service =
Eliom_service.create
~path:(Eliom_service.Path [])
~meth:(Eliom_service.Get Eliom_parameter.unit)
()
and using the original names of template.distillery, registered in “PROJECT_NAME.eliom” that after the site generation is located in the fresh site’s folder, I creatively named my site “myapp” thus the file is called “myapp.eliom”
Myapp_base.App.register
~service:Os_services.main_service
(Myapp_page.Opt.connected_page Myapp_handlers.main_service_handler);
According to my shake knowledge of Eliom, this service is responsible for the home page (e.g. localhost:8080/). I did not like the idea of having one of the pages generated by a pre-installed OCaml library, thus
- I copied “Os_serivces.main_service” from “os_services.eliom” to “myapp_services.eliom”
- with the related Myapp_services.eliomi" change and
- replacing “Os_serivces.main_service” to “Myapp_serivces.main_service” in the rest of Myapp files
- (basically, I searched for “main_service” and pedantically replaced all I could find). For example, “myapp_service.eliom” now contains
Myapp_base.App.register
~service:Myapp_services.main_service
(Myapp_page.Opt.connected_page Myapp_handlers.main_service_handler);
Unfortunately, “make test.byte” command now returns the following error
ocsigenserver: ocsigen:main: Eliom: in site / - One service or coservice has not been registered on URL /.
ocsigenserver: ocsigen:main: Please correct your modules and make sure you have linked in all the modules…
make: *** [Makefile.os:87: test.byte] Error 20
the previously working site fails to runs, and after several attempts, I failed to understand why this is happening.
Do you have any ideas or better knowledge on how to make the site to behave?