-
Notifications
You must be signed in to change notification settings - Fork 54
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
Example of using Eliom_service.register_eliom_module
?
#805
Comments
I've got a workaround that may be useful to report: The problem I hit is this: while it is obvious how to register an initialization function, it is not at all obvious (to me) how to get that registered init function to be called. From digging in to ocsigen a git, it seems like the only time these init functions get called is during the parsing of a configuration file (https://github.com/ocsigen/ocsigenserver/blob/7950e0a462164398a4b6af780d2981b0ab7b2149/src/server/ocsigen_parseconfig.ml#L379-L380). Since I am trying to port an existing site (that used opium), and have been trying to use the (iiuc) newer "static" API via Based on the docs, I tried to add various XML values to a config file, hoping to get the init function triggered, using Ultimately, this hack fixed the problem for me: shonfeder/ocsigenserver@75c300b Of course, I lose the nifty dynamic reloading functionality, but this is not worse off than I was before. It would be very nice to expose the dynamic reloading functionality via the As an example, it would be convenient to be able to call something like: Ocsigen_server.start
~ports:([`All, port])
~init:(my_init_function:unit -> unit)
[ Ocsigen_server.host ~port
[ Eliom.run () ]] Tho I can imagine some APIs that may be even cleaner (e.g., just taking a list of services and registering them). |
Eliom_service.register_eliom_module
?Eliom_service.register_eliom_module
?
Hello Shon, You shouldn't need to call Does it help to solve your issue? Don't hesitate to ask more questions. I will try to check more frequently. Our next huge documentation improvement is going to be about make the API documentation simpler to read, but working on tools and separating low level functions from the function you actually need for every day use. But this takes time. |
Hello! It looks like I may have gotten a bit confused somewhere between my own migration to Ocsigen and my (misreading) of the docs on static liking eliom modules 😅 Your clarification here, and my own further investigations, have cleared the way. I have turned some fragments of html in thunks, made some targeted use of lazy values to avoid needless recomputations. Thank you for the guidance, and I'm sorry for the noise here! |
You're welcome. This error is vey frequent anyway. I will find a way to document it better. |
I am trying to complete the migration of a simple site to Ocsigen and Eliom. I've nearly completed the migration, but I think I am now running up against the complexity of static liking eliom modules. E.g., trying to run the server defined using
Ocsigen_server.start
, I hitI believe I am hitting the problem discussed in https://ocsigen.org/eliom/latest/api/server/Eliom_service#2_StaticloadingofEliommodules . I expect I can eventually figure out how to work around this by trial and error, or studying the implementation, but it would be very helpful if there were an example of how to work around this kind of problem.
The text was updated successfully, but these errors were encountered: