telos-server 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,13 +11,13 @@ which operates on a declarative file system based CMS.
|
|
|
11
11
|
|
|
12
12
|
### 2.1 - Content
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Telos Server shall source its content and endpoints from a folder on disk, which by default shall
|
|
15
|
+
be called "telos", and shall be stored in the same directory the server process runs from.
|
|
16
16
|
|
|
17
17
|
File names in the telos folder shall have their names segmented into chunks by periods, with the
|
|
18
18
|
first chunk specifying the name of the file, the last chunk specifying the extension, and each
|
|
19
19
|
intermediate chunk specifying a property. If a property chunk contains a hyphen, the part preceding
|
|
20
|
-
the hyphen shall specify the name of the property, and the part following the
|
|
20
|
+
the hyphen shall specify the name of the property, and the part following the hyphen shall specify
|
|
21
21
|
the value of the property.
|
|
22
22
|
|
|
23
23
|
Folder names may be split the same way, though in folders the final chunk will also be a property
|
|
@@ -85,5 +85,28 @@ the following command before uploading your project:
|
|
|
85
85
|
|
|
86
86
|
#### 2.2.2 - Configuration
|
|
87
87
|
|
|
88
|
-
The
|
|
89
|
-
a numerical field in the properties with the alias "port".
|
|
88
|
+
The default port can be reconfigured with a Telos Config utility with the desired port specified as
|
|
89
|
+
a numerical field in the properties with the alias "port".
|
|
90
|
+
|
|
91
|
+
#### 2.2.3 - Middleware
|
|
92
|
+
|
|
93
|
+
Telos Server may be extended through middleware referenced in the Telos Origin APInt.
|
|
94
|
+
|
|
95
|
+
The utilities which reference such middleware shall have the "type" property specified as
|
|
96
|
+
"telos-server-middleware", and shall reference as their source a CommonJS module which exports an
|
|
97
|
+
object with a "middleware" field containing a list of middleware functions.
|
|
98
|
+
|
|
99
|
+
A middleware function shall take two arguments, the first being the HTTP request which invoked it
|
|
100
|
+
it the form of an HTTP JSON object, and the second being a file metadata object specifying
|
|
101
|
+
information about the file on disk which matches the request URI. Said metadata object shall have
|
|
102
|
+
the fields "file", containing a string specifying the full file path, "meta", containing an object
|
|
103
|
+
specifying the properties derived from the file path as shown in section 2.1.1, and "type",
|
|
104
|
+
containing a string specifying the file type.
|
|
105
|
+
|
|
106
|
+
The function may return an HTTP JSON response object representing the response to be returned to
|
|
107
|
+
the client. Additional fields may be added to the response object for certain behaviors. Ideally,
|
|
108
|
+
only one middleware function should return a response for each request, but in the event that there
|
|
109
|
+
are multiple responses, a "priority" field containing a number may be added to indicate how the
|
|
110
|
+
response should be weighed relative to others. If the response is to return a filestream rather
|
|
111
|
+
than a text response, the body of the response shall be set to the path to the streamed resource,
|
|
112
|
+
and the response object shall have the field "file", containing a boolean value of true.
|