telos-server 1.0.7 → 1.0.9

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