diff --git a/dev/manual/basics-server.html b/dev/manual/basics-server.html index 3f4bd70b..519ee84a 100644 --- a/dev/manual/basics-server.html +++ b/dev/manual/basics-server.html @@ -91,23 +91,23 @@ configure redirections etc.
Install Ocsigen Server with:
opam install ocsigenserver -
To include a Web server in your OCaml program, just add +
Let's create a new OCaml project with Dune: +dune init project mysite +
To include a Web server in your OCaml program, just add package ocsigenserver to your Dune file, together with all the extensions -you need. For example: +you need. For example, modify file bin/dune like this:
(executable (public_name mysite) (name main) (libraries ocsigenserver ocsigenserver.ext.staticmod)) -
Do -dune init project mysite -Then copy the dune file in directory bin/. -
The following command will launch a server, serving static files from +
The following command will launch a server, serving static files from directory static:
let () =
- Ocsigen_server.start [ Ocsigen_server.host [Staticmod.run ~dir:"static" ()]]
Put this in file main.ml, and run dune exec mysite. -
By default, the server runs on port 8080. + Ocsigen_server.start [ Ocsigen_server.host [Staticmod.run ~dir:"static" ()]]
Put this in file bin/main.ml, and run dune exec mysite. +
By default, the server runs on port 8080. Create a static directory +with some files and try to fetch them using your Web browser.
Alternatively, you can run command ocsigenserver with a configuration file:
ocsigenserver -c mysite.conf @@ -150,8 +150,8 @@
This section shows how to create a static executable for you program (without configuration file).
Run the following command: -
opam install ocsipersist-sqlite eliom -
Add packages ocsipersist.sqlite and eliom.server to file +
opam install ocsipersist-sqlite-config eliom +
Add packages ocsipersist-sqlite and eliom.server to file bin/dune, in the "libraries" section.
Copy the definition and registration of service myservice at the beginning of file bin/main.ml, @@ -170,7 +170,7 @@
Open URL http://localhost:8080/aaa/bbb with your browser.
Alternatively, you can decide to build your Eliom app as a library and load it dynamically into ocsigenserver using a configuration file. -
opam install ocsipersist-sqlite eliom +opam install ocsipersist-sqlite-config eliom dune init proj --kind=lib mysite cd mysiteAdd (libraries eliom.server) into file lib/dune. @@ -190,7 +190,7 @@ <commandpipe>local/var/run/mysite-cmd</commandpipe> <extension findlib-package="ocsigenserver.ext.staticmod"/> - <extension findlib-package="ocsipersist-sqlite"/> + <extension findlib-package="ocsipersist-sqlite-config"/> <extension findlib-package="eliom.server"/> <host hostfilter="*"> <static dir="local/var/www/mysite" /> diff --git a/dev/manual/basics.html b/dev/manual/basics.html index af1eff4c..3ecb3c48 100644 --- a/dev/manual/basics.html +++ b/dev/manual/basics.html @@ -85,23 +85,23 @@ configure redirections etc.
Install Ocsigen Server with:
opam install ocsigenserver -Use as a library
To include a Web server in your OCaml program, just add +
Let's create a new OCaml project with Dune: +dune init project mysite +
To include a Web server in your OCaml program, just add package ocsigenserver to your Dune file, together with all the extensions -you need. For example: +you need. For example, modify file bin/dune like this:
(executable (public_name mysite) (name main) (libraries ocsigenserver ocsigenserver.ext.staticmod)) -
Do -dune init project mysite -Then copy the dune file in directory bin/. -
The following command will launch a server, serving static files from +
The following command will launch a server, serving static files from directory static:
let () =
- Ocsigen_server.start [ Ocsigen_server.host [Staticmod.run ~dir:"static" ()]]
Put this in file main.ml, and run dune exec mysite. -
By default, the server runs on port 8080. + Ocsigen_server.start [ Ocsigen_server.host [Staticmod.run ~dir:"static" ()]]
Put this in file bin/main.ml, and run dune exec mysite. +
By default, the server runs on port 8080. Create a static directory +with some files and try to fetch them using your Web browser.
Alternatively, you can run command ocsigenserver with a configuration file:
ocsigenserver -c mysite.conf @@ -232,8 +232,8 @@
This section shows how to create a static executable for you program (without configuration file).
Run the following command: -
opam install ocsipersist-sqlite eliom -
Add packages ocsipersist.sqlite and eliom.server to file +
opam install ocsipersist-sqlite-config eliom +
Add packages ocsipersist-sqlite and eliom.server to file bin/dune, in the "libraries" section.
Copy the definition and registration of service myservice at the beginning of file bin/main.ml, @@ -243,6 +243,7 @@ ~command_pipe:"local/var/run/mysite-cmd" ~logdir:"local/var/log/mysite" ~datadir:"local/var/data/mysite" + ~default_charset:(Some "utf-8") [ Ocsigen_server.host [ Staticmod.run ~dir:"local/var/www/mysite" () @@ -252,7 +253,7 @@
Open URL http://localhost:8080/foo?myparam=Hello&i=27 with your browser.
Alternatively, you can decide to build your Eliom app as a library and load it dynamically into ocsigenserver using a configuration file. -
opam install ocsipersist-sqlite eliom +opam install ocsipersist-sqlite-config eliom dune init proj --kind=lib mysite cd mysiteAdd (libraries eliom.server) into file lib/dune.