Your first app in 5 minutes
The code of this tutorial has been tested against Eliom 6.0.
This tutorial describes how to get started with Ocsigen quickly. Thanks to an application template provided by the Ocsigen team, you will get to a working application with standard functionality like users and notifications in only a few minutes. This template can be used for learning purposes, or even as a starting point for your own product.
The template you will use comes from Ocsigen Start. Ocsigen Start provides a complete mechanism for adding and managing users, including activation links and password reset. It additionally contains a module for displaying tips, a module for sending notifications to your users, and other utilities typically needed in modern Web applications.
The template comes with a default style (developed with SASS) that follows modern Web practices, e.g., it is responsive and thus mobile-friendly. Of course, you are free to modify the style to match your own brand or personality.
The template is multi-platform. This means that it can run on a Web browser or as a mobile app for Android, iOS, or Windows.
Installation
Install the dependencies (postgresql and one of sass, sassc). On Debian-based systems:
apt install postgresql ruby-sass
Install Ocsigen Start and all its OCaml dependencies using OPAM:
opam install ocsigen-start
Create your application using Eliom distillery:
eliom-distillery -name myapp -template os.pgocaml
Have a look at the README file to learn how to compile it and, possibly, to generate the mobile applications.
I installed it and compiled it, what next?
It is now time to learn Ocsigen! The template is a great way to get started, because it comes with multiple runnable examples that show you:
- How to do remote procedure calls (RPCs);
- How to save session data (in Eliom references);
- How to use the notification system;
- How to create reactive pages;
- Many examples of widgets from Ocsigen Toolkit:
- Carousel
- Pages with several tabs
- Time and date pickers
- ...
The corresponding files are well-commented, so you can quickly find out how things work.
Have fun!