You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.cpp.md
+5-9
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ Opium
3
3
4
4
## Executive Summary
5
5
6
-
Sinatra like web toolkit for OCaml based on [cohttp](https://github.com/avsm/ocaml-cohttp/) & [lwt](https://github.com/ocsigen/lwt)
6
+
Sinatra like web toolkit for OCaml based on [cohttp](https://github.com/mirage/ocaml-cohttp/) & [lwt](https://github.com/ocsigen/lwt)
7
7
8
8
## Design Goals
9
9
@@ -15,15 +15,11 @@ _Rack_ inspired mechanism borrowed from Ruby. The middleware mechanism in
15
15
Opium is called `Rock`.
16
16
17
17
* It should maximize use of creature comforts people are used to in
18
-
other languages. Such as [sexplib](https://github.com/janestreet/sexplib), [fieldslib](https://github.com/janestreet/fieldslib), [cow](https://github.com/mirage/ocaml-cow), a decent
18
+
other languages. Such as [sexplib](https://github.com/janestreet/sexplib), [fieldslib](https://github.com/janestreet/fieldslib), a decent
19
19
standard library.
20
20
21
21
## Installation
22
22
23
-
__NOTE__: At this point there's a good chance this library will only
24
-
work against cohttp master. Once cohttp 1.0 is released then this
25
-
library will always be developed against OPAM version.
26
-
27
23
### Stable
28
24
29
25
The latest stable version is available on opam
@@ -43,9 +39,9 @@ $ opam pin add opium --dev-repo
43
39
44
40
## Examples
45
41
46
-
All examples are built once the necessary dependencies are installed (`cow`).
47
-
`$ make` will compile all examples. The binaries are located in
48
-
`_build/examples/`
42
+
All examples are built once the necessary dependencies are installed.
43
+
`$ dune build @examples` will compile all examples. The binaries are located in
Copy file name to clipboardExpand all lines: README.md
+22-27
Original file line number
Diff line number
Diff line change
@@ -15,21 +15,17 @@ _Rack_ inspired mechanism borrowed from Ruby. The middleware mechanism in
15
15
Opium is called `Rock`.
16
16
17
17
* It should maximize use of creature comforts people are used to in
18
-
other languages. Such as [sexplib](https://github.com/janestreet/sexplib), [fieldslib](https://github.com/janestreet/fieldslib), [cow](https://github.com/mirage/ocaml-cow), a decent
18
+
other languages. Such as [sexplib](https://github.com/janestreet/sexplib), [fieldslib](https://github.com/janestreet/fieldslib), a decent
19
19
standard library.
20
20
21
21
## Installation
22
22
23
-
__NOTE__: At this point there's a good chance this library will only
24
-
work against cohttp master. Once cohttp 1.0 is released then this
25
-
library will always be developed against OPAM version.
26
-
27
23
### Stable
28
24
29
25
The latest stable version is available on opam
30
26
31
27
```
32
-
opam install opium
28
+
$ opam install opium
33
29
```
34
30
35
31
### Master
@@ -38,20 +34,20 @@ If you'd like to live on the bleeding edge (which is sometimes more stable than
38
34
stable)
39
35
40
36
```
41
-
opam pin add opium --dev-repo
37
+
$ opam pin add opium --dev-repo
42
38
```
43
39
44
40
## Examples
45
41
46
-
All examples are built once the necessary dependencies are installed (`cow`).
47
-
`make` will compile all examples. The binaries are located in
48
-
`_build/examples/`
42
+
All examples are built once the necessary dependencies are installed.
43
+
`$ dune build @examples` will compile all examples. The binaries are located in
44
+
`_build/default/examples/`
49
45
50
46
### Hello World
51
47
52
48
Here's a simple hello world example to get your feet wet:
53
49
54
-
`cat hello_world.ml`
50
+
`$ cat hello_world.ml`
55
51
56
52
```ocaml
57
53
open Opium.Std
@@ -87,14 +83,13 @@ let _ =
87
83
88
84
compile with:
89
85
```
90
-
ocamlbuild -pkg opium hello_world.native
86
+
$ ocamlbuild -pkg opium.unix hello_world.native
91
87
```
92
88
93
89
and then call
94
-
```
95
-
./hello_world.native &
96
-
curl http://localhost:3000/person/john_doe/42
97
-
```
90
+
91
+
./hello_world.native &
92
+
curl http://localhost:3000/person/john_doe/42
98
93
99
94
You should see a JSON message.
100
95
@@ -115,13 +110,13 @@ favourite browser.
115
110
116
111
```ocaml
117
112
open Opium.Std
118
-
open Opium_misc
119
113
120
114
(* don't open cohttp and opium since they both define
121
115
request/response modules*)
122
116
123
-
let is_substring ~substring s =
124
-
Option.is_some (String.substr_index s ~pattern:substring)
0 commit comments