telos-server 1.0.7 → 1.0.8
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 +87 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Telos Server
|
|
2
|
+
|
|
3
|
+
## 1 - Abstract
|
|
4
|
+
|
|
5
|
+
Telos Server is a server built on [Telos Origin](https://github.com/Telos-Project/Telos-Origin),
|
|
6
|
+
which operates on a declarative file system based CMS.
|
|
7
|
+
|
|
8
|
+
## 2 - Contents
|
|
9
|
+
|
|
10
|
+
### 2.1 - Content
|
|
11
|
+
|
|
12
|
+
The Telos Server shall source its content and endpoints from a folder on disk, which by default
|
|
13
|
+
shall be called "telos", and shall be stored in the same directory the server process runs from.
|
|
14
|
+
|
|
15
|
+
File names in the telos folder shall have their names segmented into chunks by periods, with the
|
|
16
|
+
first chunk specifying the name of the file, the last chunk specifying the extension, and each
|
|
17
|
+
intermediate chunk specifying a property. If a property chunk contains a hyphen, the part preceding
|
|
18
|
+
the hyphen shall specify the name of the property, and the part following the hypen shall specify
|
|
19
|
+
the value of the property.
|
|
20
|
+
|
|
21
|
+
Folder names may be split the same way, though in folders the final chunk will also be a property
|
|
22
|
+
chunk rather than an extension. Files will inherit properties from any ancestor folders.
|
|
23
|
+
|
|
24
|
+
Folder and file paths shall consist of their name chunks concatenated together in order by forward
|
|
25
|
+
slashes, with file extensions being optional to resolve conflicts. The telos folder itself shall
|
|
26
|
+
not be included. If a folder contains a file with the name chunk "index", the path to said folder
|
|
27
|
+
shall redirect to said file.
|
|
28
|
+
|
|
29
|
+
#### 2.1.1 - Example
|
|
30
|
+
|
|
31
|
+
If you have the following file path:
|
|
32
|
+
|
|
33
|
+
a/b.c/d.e.f-g.h
|
|
34
|
+
|
|
35
|
+
The paths to this file shall be:
|
|
36
|
+
|
|
37
|
+
a/b/d
|
|
38
|
+
a/b/d.h
|
|
39
|
+
|
|
40
|
+
And its properties will be:
|
|
41
|
+
|
|
42
|
+
{ "c": true, "e": true, "f": "g" }
|
|
43
|
+
|
|
44
|
+
#### 2.1.2 - Properties
|
|
45
|
+
|
|
46
|
+
##### 2.1.2.1 - API
|
|
47
|
+
|
|
48
|
+
If a JS file has the property "api", it shall serve as an API endpoint. As such, it shall be
|
|
49
|
+
expected to use Common JS to assign as the module exports a single function which takes the request
|
|
50
|
+
as an [HTTP JSON](https://github.com/Telos-Project/AutoCORS?tab=readme-ov-file#211---http-json)
|
|
51
|
+
object, and returns an HTTP JSON object representing the response, or a null value to indicate a
|
|
52
|
+
blank response.
|
|
53
|
+
|
|
54
|
+
##### 2.1.2.2 - Private
|
|
55
|
+
|
|
56
|
+
If a file has the property "private", it shall be inaccessible from the client.
|
|
57
|
+
|
|
58
|
+
##### 2.1.2.3 - Universal Preprocessor
|
|
59
|
+
|
|
60
|
+
If a file has the property "pup", it will be processed by the
|
|
61
|
+
[Universal Preprocessor](https://github.com/Telos-Project/Universal-Preprocessor) before being
|
|
62
|
+
fetched.
|
|
63
|
+
|
|
64
|
+
### 2.2 - Usage
|
|
65
|
+
|
|
66
|
+
#### 2.2.1 - Setup
|
|
67
|
+
|
|
68
|
+
First, create a folder for your project. Within this folder, create your "telos" folder, and
|
|
69
|
+
populate it with the content you intend to serve.
|
|
70
|
+
|
|
71
|
+
Next, navigate to said folder in the terminal, and run the following command:
|
|
72
|
+
|
|
73
|
+
npx telos-origin -m install telos-server
|
|
74
|
+
|
|
75
|
+
If you wish to run the server, which will be on port 80 by default, run the following command:
|
|
76
|
+
|
|
77
|
+
npx telos-origin
|
|
78
|
+
|
|
79
|
+
If you want to deploy your server to a cloud host such as [render.com](https://render.com/), run
|
|
80
|
+
the following command before uploading your project:
|
|
81
|
+
|
|
82
|
+
npx telos-origin -m wrap
|
|
83
|
+
|
|
84
|
+
#### 2.2.2 - Configuration
|
|
85
|
+
|
|
86
|
+
The defualt port can be reconfigured with a Telos Config utility with the desired port specified as
|
|
87
|
+
a numerical field in the properties with the alias "port".
|