<commit_before>Page Park
=========

A simple folder-based HTTP server that serves as a place for "parking" simple static sites for domains I've bought but not yet used.

This is the second of three early 2015 "server snacks" by <NAME>.

#### Basic features 

xxx

#### How it works

xxx

#### Example URLs

http://noderunner.org/ -- simple home page

http://lucky.wtf/ -- images

http://lucky.wtf/test.md -- markdown page

http://lucky.wtf/badass/ -- index file in a sub-directory

http://lucky.wtf/badass/butt.js -- a page implemented in a script

http://pagepark.io/ -- the home page for this product, served by the product

http://karass.co/ -- file not found


<commit_msg>v0.46<commit_after>PagePark
========

I wrote this simple Node.js folder-based HTTP server that serves simple static and dynamic pages for domains I've bought but not yet used.

It's also designed to be simple code you can learn from, or form to be whatever you like. But it's 90 percent of what all web servers do, so if you learn how to run Page Park, you're learning how to run a web server.

This is the second of three early 2015 "server snacks" by <NAME>.

#### How it works

Create a folder to host your website. 

Copy pagepark.js into that folder, and run it: node pagepark.js

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.

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).

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.

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. 

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

Here's a <a href="http://scripting.com/2015/01/04/pageParkFolderScreenShot.png">screen shot</a> of my PagePark server folder. 

#### Example pages

http://noderunner.org/ -- simple home page

http://lucky.wtf/ -- images

http://lucky.wtf/test.md -- markdown page

http://lucky.wtf/badass/ -- index file in a sub-directory

http://lucky.wtf/badass/butt.js -- a page implemented in a script

http://pagepark.io/ -- the home page for this product, served by the product

http://karass.co/nosuchfile.html -- file not found

http://pagepark.io/status -- information about the server

http://pagepark.io/version -- the version of PagePark that's running on the server

http://pagepark.io/now -- the time on the server

#### JavaScript sample code

I've iterated over the code to try to make it good sample code for JavaScript projects. 

I wanted to make code that could be used for people who are just getting started with Node, to help make the process easier.

There will always be more work to do here. ;-)

#### Questions, comments?

Please post a note on the <a href="https://groups.google.com/forum/#!forum/server-snacks">Server Snacks</a> mail list. 

{'fraction_non_alphanumeric': 0.08078491335372069, 'fraction_numerical': 0.005351681957186544, 'mean_word_length': 3.6504739336492893, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5463567', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1056, 'n_words': 580}