Skip to content

Commit de4081c

Browse files
committed
Merge pull request #27 in LCL/wolframengineforpython from feature/docs to master
* commit '3b6321428d2dd79760479881db29965ec52c5848': adding a meaningful API fixing paragraph adding a note when installing using source code
2 parents 876b7f5 + 3b63214 commit de4081c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Install the library in your site-package directory:
3838
>>> pip3 install .
3939
```
4040

41+
The following method is not installing the library globally, therefore all the example commands needs to run from the cloned directory.
42+
4143
### Start a demo server
4244

4345
Start a demo server by doing:
@@ -61,7 +63,7 @@ Now you can open your web browser at the address http://localhost:18000/
6163
1. Use a single file with URLDispatcher
6264
2. Use multiple files in a directory layout
6365

64-
## Single file with URLDispatcher
66+
### Single file with URLDispatcher
6567

6668
One way to run your server is to direct all requests to a single file
6769
that runs a Wolfram Language [URLDispatcher](https://reference.wolfram.com/language/ref/URLDispatcher.html) function.
@@ -98,7 +100,7 @@ http://localhost:18000/api
98100

99101
For more information about `URLDispatcher` please refer to the [online documentation](https://reference.wolfram.com/language/ref/URLDispatcher.html).
100102

101-
## Multiple files in a directory layout
103+
### Multiple files in a directory layout
102104

103105
Another way to write an application is to create a directory structure that is served by the server. The url for each file will match the file's directory path.
104106

@@ -116,8 +118,8 @@ mkdir testapp/form
116118
mkdir testapp/api
117119
echo 'ExportForm[{"hello", UnixTime[]}, "JSON"]' > testapp/index.wl
118120
echo 'FormFunction["x" -> "String"]' > testapp/form/index.wl
119-
echo 'APIFunction["x" -> "String"]' > testapp/api/index.wl
120-
echo 'HTTPResponse["hello world"]' > testapp/api/response.wl
121+
echo 'APIFunction["x" -> "Number", #x! &]' > testapp/api/index.wl
122+
echo 'HTTPResponse["hello world"]' > testapp/response.wl
121123
echo '["some", "static", "JSON"]' > testapp/static.json
122124
```
123125

@@ -138,14 +140,15 @@ Then open the browser at the following locations:
138140
```
139141
http://localhost:18000/
140142
http://localhost:18000/form
141-
http://localhost:18000/api
143+
http://localhost:18000/api?x=4
144+
http://localhost:18000/response.wl
142145
http://localhost:18000/static.json
143146
```
144147

145148
One advantage of a multi-file application structure is that is very easy to extend the application. You can simply place new files into the appropriate location in your application directory and they will automatically be served.
146149

147150

148-
### Options
151+
## Options
149152

150153
```
151154
>>> python3 -m wolframwebengine --help

0 commit comments

Comments
 (0)