-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
161 lines (129 loc) · 3.54 KB
/
index.html
File metadata and controls
161 lines (129 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<head>
<title>Woses Webserver</title>
<link rel="icon" href="wose.png"/>
<style>
pre, code { color: #060; font-size: 11pt; }
pre { margin-left: 2ex; padding: 1ex; background-color: #eee; }
p { font-size: 12pt; }
body {
margin-left: 10%;
margin-right: 10%;
background-color: #fff;
color: black;
max-width: 800px;
}
h1,h2,h3,h4 { font-family: helvetica }
h1 { font-size: 36pt; }
h1 {
background-color: #58b;
color: white;
padding-left:6px;
}
h2 {
color: #28b;
}
li > code:first-child {
font-weight: bold;
}
.right {
float: right;
padding-right: 0.5ex;
}
form, input {
display: inline;
}
</style>
</head>
<body>
<h1>
<!--☶ ☁ ⎈ 𐂷 ☃-->
Woses <span class=right style=color:black>⚉</span>
</h1>
<p>
Woses is a <a href=http://nodejs.org/>Node</a>-based webserver with
support for <a href=http://php.net/>PHP</a> templating.
<p>
Additionally it includes a mechanism for server-side JavaScript RPC.
<p>
The home page for Woses is
<a href=http://grumdrig.com/woses/>http://grumdrig.com/woses/</a>. The
code lives at
<a href=http://github.com/grumdrig/woses>http://github.com/grumdrig/woses</a>.
<h2>Usage</h2>
<pre>
$ node woses.js DOCUMENT_ROOT
</pre>
will run the HTTP server against the content in DOCUMENT_ROOT. For example,
<pre>
$ node woses.js doc
</pre>
<p>
will serve this documentation on <a href=http://localhost:8053/>port
8053</a>.
<p>
Included also is the script <code>serverloop.py</code> which runs the
server in a loop, polling for changes to the configuration
file, <code>woses.js</code>, or files listed on the command line.
Changes or <code>^C</code> restart the server. This is most useful for
running the server during development. Usage is:
<pre>
$ ./serverloop.py DOCUMENT_ROOT [OTHER_FILES...]
</pre>
<h2> Configuration </h2>
<p>
Woses can be configured by placing a file
called <code>.woses-conf.js</code> in the document root. This file may
export the following settings:
<ul>
<li> <code>port</code>: A port other than the default 8053 on which to
serve.
<li> <code>index</code>: Name of a directory index page to use for
URI's which point to a folder, rather than the
default, <code>index.html</code> falling back
to <code>index.php</code>.
<li> <code>mimetypes</code>: A map from file extensions to MIME types
for serving content.
</ul>
Here is an example configuration file:
<pre>
exports.port = 80;
exports.index = "home.html";
exports.mimetypes = {
'.gif': 'image/gif',
'.readme': 'text/plain'
}
</pre>
<h2> PHP </h2>
<p>
Woses will serve PHP scripts through the mechanism of the PHP
command-line interface; thus the <code>php</code> command must be available for
woses to serve PHP scripts.
<p>
The big caveat of PHP support is that, within PHP code, calls to
`header()' have no effect.
<h2> JS RPC </h2>
<p>
Requests for filenames ending in <code>-rpc.js</code> (some more
sensible mechanism to distinguish is a TODO item) are loaded as
modules and the HTTP request is proxied through their
exported <code>fetch</code> function, with signature:
<pre>
exports.fetch = function(request, response) {
// ...
response.body = ...;
};
</pre>
<h2> JS Templating </h2>
<p>
Templating in the style of EJS / Resig's micro-templating is planned,
but not implemented
<h2> Security </h2>
<p>
URLs with ".." in them are disallowed, but security is probably poor
at the moment. That is, an attacker may be able to pwn your system if
you are running this on a public server.
<h2> Tests </h2>
If this page is served by Woses itself,
<a href=test/>this is a test page.</a>
<br>
<br>