Permalink
Browse files

make example easily runnable

  • Loading branch information...
igorw committed Dec 28, 2011
1 parent 6926051 commit 852bbca7b4b31e296e05a5aee59668264b5a69c3
Showing with 39 additions and 3 deletions.
  1. +12 −2 README.md
  2. +3 −0 example/.gitignore
  3. +3 −1 example/hello.php
  4. 0 example/logs/.gitkeep
  5. +21 −0 example/mongrel2.conf
  6. 0 example/run/.gitkeep
View
@@ -58,8 +58,18 @@ while (true) {
}
```
- $ php example/hello.php
- $ curl http://localhost:6767/handlertest
+Example
+-------
+
+To run the example, run the following commands:
+
+ $ cd example
+ $ m2sh load
+ $ m2sh start
+ # in a separate shell
+ $ php hello.php
+ # in a separate shell or browser
+ $ curl http://localhost:6767/hello
Tests
-----
View
@@ -0,0 +1,3 @@
+config.sqlite
+logs/*
+run/*
View
@@ -2,6 +2,8 @@
use Mongrel2\Connection;
+require __DIR__.'/../vendor/.composer/autoload.php';
+
$sender_id = "82209006-86FF-4982-B5EA-D1E29E55D481";
$conn = new Connection($sender_id, "tcp://127.0.0.1:9997", "tcp://127.0.0.1:9996");
@@ -12,5 +14,5 @@
continue;
}
- $this->conn->reply_http($req, 'Hello World');
+ $conn->reply_http($req, 'Hello World');
}
View
No changes.
View
@@ -0,0 +1,21 @@
+hello_handler = Handler(
+ send_spec='tcp://*:9997',
+ send_ident='ab206881-6f49-4276-9db1-1676bfae18b0',
+ recv_spec='tcp://*:9996', recv_ident=''
+)
+
+main = Server(
+ uuid="9e71cabf-6afb-4ee1-b550-7972245f7e0a",
+ access_log="/logs/access.log",
+ error_log="/logs/error.log",
+ chroot="./",
+ default_host="localhost",
+ name="example",
+ pid_file="/run/mongre2.pid",
+ port=6767,
+ hosts = [
+ Host(name="localhost", routes={'/hello':hello_handler})
+ ]
+)
+
+servers = [main]
View
No changes.

0 comments on commit 852bbca

Please sign in to comment.