You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first line of each route script is checked for a "directive". These are special
9
+
comments that let you override the way a route is handled internally.
10
+
11
+
These are the directives that currently exist:
12
+
13
+
- `# sse`- this route will be used for [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) [(example)](https://github.com/cgsdev0/bash-stack/blob/main/examples/jeopardy-buzzer/pages/sse/%5Busertype%5D/%5Broom%5D.sh)
14
+
- `# allow-uploads`- this route will allow file uploads via a multipart encoded form. [(example)](https://github.com/cgsdev0/bash-stack/blob/main/examples/file-upload/pages/upload.sh)
15
+
- `# headers`- this route will be responsible for writing its own headers section, in addition to the response body. [(example)](https://github.com/cgsdev0/bash-stack/blob/main/examples/jeopardy-buzzer/pages/login.sh)
16
+
17
+
18
+
## Request Variables
19
+
20
+
The following variables are available in all route handlers:
21
+
22
+
- `REQUEST_METHOD`- the HTTP verb used
23
+
- `REQUEST_PATH`- the relative path of the request
24
+
- `REQUEST_QUERY`- the raw (unparsed) query string
25
+
26
+
The framework will automatically parse the request and populate the following associative arrays:
27
+
28
+
- `HTTP_HEADERS`- The parsed request headers
29
+
- `QUERY_PARAMS`- The parsed query parameter string
30
+
- `FORM_DATA`- The parsed form data (if applicable)
31
+
- `PATH_VARS`- The parsed variable names for dynamic and catch-all routes
32
+
- `COOKIES`- The parsed cookies from the request headers
33
+
34
+
The following are only used if you are writing an upload handler:
35
+
36
+
- `FILE_UPLOADS`- A mapping of input names -> tmp files
37
+
- `FILE_UPLOAD_TYPES`- A mapping of input names -> file upload types (according to the request)
38
+
- `FILE_UPLOAD_NAMES`- A mapping of input names -> original filenames
0 commit comments