package eliom-compat

All checked builds pass
  1. Overview
  2. Docs
Eliom: backward-compatible module names (Eliom_xxx)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

13.0.0.tar.gz
md5=904867e857f818f5bc950f6da588f060
sha512=2c40a53b955297b6cba603d1efb7bf9613a5b52555c940397ed1643165ae258dd59bfebed53c160b2cb63372e038121c5973616cab45e906a6c7bfc6f2d924c2

Description

Provides the old Eliom_xxx module names (e.g. Eliom_service, Eliom_content) as aliases to the new Eliom.Xxx modules. Use this package to ease migration of existing code.

Added to opam-repository:

README

Eliom - the full-stack OCaml Web and mobile framework

Eliom is a framework for building client/server Web and mobile applications in OCaml.

It can be used both as a traditional server-side Web framework or to implement complex client-server applications.

Eliom transforms OCaml into a multi-tier language, making it possible to implement both the server and client parts of a Web and mobile app as a single program.

This simplifies a lot the communication between server and client. Applications can run on any Web browser or mobile device (iOS, Android), saving from the need to develop one version for each platform.

Eliom has support for reactive pages (generated on server or client), advanced session mechanism, server to client communication, continuation based Web programming, etc.

Eliom is part of the Ocsigen project.

Installation Instructions

opam install eliom

Getting started

Defining a service on path /foo, taking any GET parameters:

let myservice =
  Eliom.Service.create
    ~path:(Eliom.Service.Path ["foo"])
    ~meth:(Eliom.Service.Get (Eliom.Parameter.any))
    ()

let () =
  Eliom.Registration.Html.register ~service:myservice
    (fun get_params () ->
      Lwt.return
         Eliom.Content.Html.F.(html (head (title (txt "")))
                                    (body [h1 [txt "Hello"]])))

Inserting a link towards that service, with parameters:

Eliom.Content.Html.D.a ~service:myservice [txt "Home"] [("param1", "v1"); ("param2", "v2")]

Event handlers are written in OCaml:

div ~a:[a_onclick [%client (fun ev -> ... )]] [ ... ]

The client-side and server sides are written as a single program:

let%server a = ... (* code for the server part of the application *)

let%client b = ... (* code for the client part of the application *)

let%shared c = ... (* code that will be included in both parts *)

Using a server-side value in client-side code:

let%server a = ...

let%client f () =
  print_endline ~%a ; (* print in browser console *)
  ...

Calling a server function from the client program:

let%rpc f (x : int) : string Lwt.t = ... (* server-side code *)

let%client () =
  let%lwt r = f 4 in
  ...

Saving session data on the server using Eliom references:

let%server r = Eliom.Reference.eref ~scope:Eliom.Common.default_session_scope 0

let%server f () =
  let%lwt v = Eliom.Reference.get r in
  Eliom.Reference.set r (v + 1);
  ...

Where scope can be:

  • Eliom.Common.default_session_scope (different value for each browser),
  • Eliom.Common.default_process_scope (different value for each tab),
  • Eliom.Common.default_group_scope (different value for each user),
  • Eliom.Common.site_scope (value for the whole site),
  • Eliom.Common.global_scope (global value for the whole server). Eliom references are persistent if you add ~persistent:(name, json_codec) to function Eliom.Reference.eref. Their values are then stored with Ocsipersist, whose database location must be configured.

Learning Eliom

More documentation here.

Write your first Web and mobile application with Eliom using Ocsigen Start

Authors

  • Vincent Balat
  • Jérôme Vouillon
  • Grégoire Henry
  • Pierre Chambart
  • Benedikt Becker
  • Vasilis Papavasileiou
  • Boris Yakobowski
  • Hugo Heuzard
  • Raphaël Proust
  • Jan Rochel
  • Idir Lankri
  • Stéphane Glondu
  • Gabriel Radanne
  • Gabriel Kerneis
  • Denis Berthod
  • Jaap Boender
  • Simon Castellan
  • Mauricio Fernandez
  • Archibald Pontier
  • Simon Castellan
  • Kate Deplaix

Dependencies (2)

  1. eliom = version
  2. dune >= "3.19"

Dev Dependencies (1)

  1. odoc with-doc

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building eliom-compat with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
13.0.0 (this version) n/a good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure