Skip to content

Commit 36be8da

Browse files
committed
Another silly example
1 parent 5f2b0aa commit 36be8da

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

doc/source/examples.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,30 @@ This can be achieved using :ref:`middlewares <middlewares>`:
2727
With that last example, our API at ``localhost:8000`` will act as a proxy to
2828
``example.com``. All requests will be responded immediately except
2929
``some/endpoint`` which will have a delay of 2 seconds.
30+
31+
An API powered by multiple languages
32+
------------------------------------
33+
34+
.. code:: sh
35+
36+
mock serve -p 8000 \
37+
--route js \
38+
--exec '
39+
node <<EOF | mock write
40+
console.log("Hello from Node.js!")
41+
EOF
42+
' \
43+
--route python \
44+
--exec '
45+
python3 <<EOF | mock write
46+
print("Hello from Python!")
47+
EOF
48+
' \
49+
--route php \
50+
--exec '
51+
php <<EOF | mock write
52+
<?php
53+
echo "Hello from PHP!\n";
54+
?>
55+
EOF
56+
'

0 commit comments

Comments
 (0)