master
Dave Winer 10 years ago
parent c5480faf34
commit d17989ed02

@ -7,29 +7,31 @@ It's also designed to be simple code you can learn from, or form to be whatever
This is the second of three early 2015 "server snacks" by Dave Winer.
#### How it works
#### How to
1. Create a folder to host your website.
Create a folder to host your website.
2. Copy pagepark.js into that folder, and run it: node pagepark.js
Copy pagepark.js into that folder, and run it: node pagepark.js
#### How it works
It will automatically create a prefs folder and a domains folder.
1. It will automatically create a prefs folder and a domains folder.
Add your web content under domains. Each folder's name is the name of a domain. The contents within the folder are what we serve.
2. Add your web content under domains. Each folder's name is the name of a domain. The contents within the folder are what we serve.
Serves all major media types including audio and video. Files whose names end with .md are passed through the built-in Markdown processor. Files ending with .js are interpreted as scripts. The text they return is what we serve.
3. Serves all major media types including audio and video. Files whose names end with .md are passed through the built-in Markdown processor. Files ending with .js are interpreted as scripts. The text they return is what we serve.
The prefs folder contains a file of settings you can change, prefs.json. These include the port that the server runs on and the name of the index file (see below).
4. The prefs folder contains a file of settings you can change, prefs.json. These include the port that the server runs on and the name of the index file (see below).
stats.json contains information generated by the server including the number of times the server has started, how many hits it's received (all time and today), and hits by domain.
5. stats.json contains information generated by the server including the number of times the server has started, how many hits it's received (all time and today), and hits by domain.
mdTemplate.txt is the template we use to serve Markdown text. You can edit this file to provide a common template for all your Markdown documents.
6. mdTemplate.txt is the template we use to serve Markdown text. You can edit this file to provide a common template for all your Markdown documents.
If a request comes in for a folder, we scan the folder for a file whose name begins with *index* and serve the first one we find. So the index file can be HTML, Markdown or a script, or any other type PagePark can serve.
7. If a request comes in for a folder, we scan the folder for a file whose name begins with *index* and serve the first one we find. So the index file can be HTML, Markdown or a script, or any other type PagePark can serve.
If you want to run PagePark from a folder different from the one that contains the app, set the *pageparkFolderPath* environment variable to point to that folder.
8. If you want to run PagePark from a folder different from the one that contains the app, set the *pageparkFolderPath* environment variable to point to that folder.
There are three special endpoints on all domains: /version, /now and /status that return the version of PagePark that's running, the time on the server and the stats and prefs.
9. There are three special endpoints on all domains: /version, /now and /status that return the version of PagePark that's running, the time on the server and the stats and prefs.
#### Screen shot

Loading…
Cancel
Save