Skip to content

Commit 147e073

Browse files
committed
Documentation Update
1 parent 372f63c commit 147e073

7 files changed

Lines changed: 27 additions & 18 deletions

File tree

docs/index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ If you know how to write a monadic, result-returning APL function, you're ready
4242

4343
1. Next, create an instance of `Jarvis` using `Jarvis.New`.
4444

45-
```
46-
j←Jarvis.New ''
47-
```
48-
This will create a `Jarvis` instance with all settings set to their default values. By default, `Jarvis` will use port 8080 and look for your endpoint code in `#`.
45+
j←Jarvis.New ''
46+
47+
This will create a `Jarvis` instance with all settings set to their default values. By default, `Jarvis` will use port 8080 and look for your endpoint code in `#`.
4948

5049
1. You can now run your web service running on port 8080 and serving code from the # (root) namespace.
51-
```
52-
(rc msg)←j.Start
53-
2024-09-06 @ 15.46.24.199 - Starting Jarvis 1.18.1
54-
2024-09-06 @ 15.46.24.217 - Conga copied from C:\Program Files\Dyalog\Dyalog APL-64 19.0 Unicode/ws/conga
55-
2024-09-06 @ 15.46.24.221 - Local Conga v3.5 reference is #.Jarvis.[LIB]
56-
2024-09-06 @ 15.46.24.231 - Jarvis starting in "JSON" mode on port 8080
57-
2024-09-06 @ 15.46.24.232 - Serving code in #
58-
2024-09-06 @ 15.46.24.237 - Click http://192.168.001.123:8080 to access web interface
59-
```
50+
51+
```
52+
(rc msg)←j.Start
53+
2024-09-06 @ 15.46.24.199 - Starting Jarvis 1.18.1
54+
2024-09-06 @ 15.46.24.217 - Conga copied from C:\Program Files\Dyalog\Dyalog APL-64 19.0 Unicode/ws/conga
55+
2024-09-06 @ 15.46.24.221 - Local Conga v3.5 reference is #.Jarvis.[LIB]
56+
2024-09-06 @ 15.46.24.231 - Jarvis starting in "JSON" mode on port 8080
57+
2024-09-06 @ 15.46.24.232 - Serving code in #
58+
2024-09-06 @ 15.46.24.237 - Click http://192.168.001.123:8080 to access web interface
59+
```
6060
6161
If the server started successfully, you'll see messages similar to those above displayed to the APL session and the return code `rc` should be `0` and `msg` should be empty. If there was any problem starting `Jarvis`, `rc` will be non-`0` and `msg` will contain a (hopefully) helpful message about the problem that occurred.
6262

docs/request.md

Whitespace-only changes.

docs/rest.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Rather than writing a function for each endpoint as in the JSON paradigm, you wi
99

1010
You specify which HTTP methods your REST service will support using the [`RESTMethods`](settings-rest.md#restmethods) setting. For instance, setting `RESTMethods←'Get'` indicates that your service will support only HTTP GET requests. Such requests will call the `#.CodeLocation.Get` function, passing the HTTP request as its right argument. For the purposes of this document, we'll call the request right argument `Request`.
1111

12-
Your `Get` function would then look at the resource being requested by parsing [`Request.Endpoint`](httprequest.md#endpoint) element. If [`DefaultContentType`](settings-operational.md#defaultcontenttype) is set to `'application/json'` (the default), your function can return an APL array which `Jarvis` will convert to JSON. If you are not using `'application/json'`, then you will need to:
12+
Your `Get` function would then look at the resource being requested by parsing [`Request.Endpoint`](request.md#endpoint) element. If [`DefaultContentType`](settings-operational.md#defaultcontenttype) is set to `'application/json'` (the default), your function can return an APL array which `Jarvis` will convert to JSON. If you are not using `'application/json'`, then you will need to:
1313

14-
1. use [`Request.SetContentType`](httprequest.md#contenttype) to set an appropriate content type
14+
1. use [`Request.SetContentType`](request.md#contenttype) to set an appropriate content type
1515
2. set the `Request.Response.Payload` to the content you want to send back to the client
1616

1717
### The client sends a request
@@ -32,7 +32,7 @@ When `Jarvis` receives the request, it verifies that the request is well-formed.
3232
### `Jarvis` calls your method function
3333
`Jarvis` passes the [`Request`](./reference.md#request) object as the right argument to the function appropriate for the HTTP method being used. It is up to your function to parse `Request.Endpoint` to determine the resource being requested. As noted above, if the response payload's `content-type` is `'application/json'` your function can return an APL array which `Jarvis` will automatically convert to JSON. Otherwise, your function is responsible for setting the `Request.Response.Payload` and `Request.ContentType` appropriately.
3434

35-
If the requested resource is not found, or some other issue occurs, your function should fail the request with an appropriate HTTP status code using [`Request.Fail`](./httprequest.md#fail). For example, an HTTP status code of 404 means that the requested resource was not found and you would use `Request.Fall 404` to set the status code.
35+
If the requested resource is not found, or some other issue occurs, your function should fail the request with an appropriate HTTP status code using [`Request.Fail`](request.md#fail). For example, an HTTP status code of 404 means that the requested resource was not found and you would use `Request.Fall 404` to set the status code.
3636

3737
!!! tip "Advanced Usage"
3838
**Jarvis** has a few specific places where you can "inject" your own APL code to perform actions like additional request validation, authentication, and so on. Two such places are available after `Jarvis` receives the request, but before calling your function. These are:

docs/settings-hooks.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
|Examples|`j.AuthenticateFn←'Authenticate'`|
2121
|Notes|See [Authentication](./security.md#authentication) for more information about how to authenticate an HTTP request.|
2222

23+
### `PostProcessFn`
24+
|--|--|
25+
|Description|`PostProcessFn` is the name of monadic, non-result-returning function to be called *after* your endpoint has run but *before* the response is sent to the client. The right argument to the function is the [`Request`](./request.md) instance. The function should not return a result however, if it does, that result is ignored.<br>If you have some treatment that you need to apply to every response, `PostProcessFn` can be used to avoid having to add that treatment to every endpoint.|
26+
|Default|`''`|
27+
|Examples|`j.PostProcessFn←'PostProcess'`<br><br>&emsp;&emsp;&emsp;`∇ PostProcess req`<br>`[1] 'custom-header'req.SetHeader'some value' ⍝ add a custom header`<br>`[2] req.Reponse.Payload.Message←'Have a nice day!' ⍝ modify the payload`<br>&emsp;&emsp;&emsp;``|
28+
29+
30+
2331
### `SessionInitFn`
2432
|--|--|
2533
|Description|`SessionInitFn` is the name of a monadic, result-returning function that can perform session initialization if your web service is using sessions. The right argument is the [`Request`](./request.md) instance, which we'll call `req`. The reference to the session namespace is `req.Session`. The integer function result should be either:<ul><li>`0` - indicating that the session was successfully initialized</li><li>non-`0` - indicating session initialization failed; in which case `Jarvis` will fail the request with an HTTP status code of 500 ().</li></ul>|

docs/settings-json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ These settings apply when using **Jarvis**'s JSON paradigm.
3131
|Description|When a requested endpoint is not found, `Jarvis` will always respond by setting the response HTTP status code to `404` and HTTP status message to `'Not Found'`. `Report404InHTML` controls whether `Jarvis` will also return a simple "not found" HTML page in its response payload. This is potentially useful when the client is a web browser. Valid settings are:<ul><li>`1` - return a simple HTML page in the response payload indicating the requested endpoint was not found. This is useful when the client connecting to `Jarvis` is a web browser.</li><li>`0` - Do not return any information in the response payload.|
3232
|Default|`1`|
3333
|Examples|`j.Report404←0 ⍝ disable sending the "not found" HTML page`|
34-
|Notes|`Report404InHTML` has effect only if the [`HTMLInterface`](.settings-json.md) is enabled.|
34+
|Notes|`Report404InHTML` has effect only if the [`HTMLInterface`](#htmlinterface) is enabled.|

docs/settings-shared.md

Whitespace-only changes.

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ nav:
7979
- 'Conga-Related Settings': 'settings-conga.md' # complete
8080
- 'CORS Settings': 'settings-cors.md' # complete
8181
- 'Container Settings': 'settings-container.md' # complete
82+
- 'Shared Settings': settings-shared.md
8283
- 'Methods':
8384
- 'Shared Methods': 'methods-shared.md'
8485
- 'Instance Methods': 'methods-instance.md'
@@ -87,7 +88,7 @@ nav:
8788
- Advanced Topics:
8889
- 'Security' : 'security.md'
8990
- 'Using Sessions' : 'sessions.md'
90-
# - 'Docker Integration' : 'docker.md'
91+
- 'Docker Integration' : 'docker.md'
9192
# - 'Running as a Windows Service' : 'winservice.md'
9293
# - 'Into the Cloud' : 'cloud.md'
9394
- About:

0 commit comments

Comments
 (0)