File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff 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+ '
You can’t perform that action at this time.
0 commit comments