Pillar7 is a minimal / hackable node.js web server built around the idea that making content available on the web presented in a reasonable way should not require:
Pillar7 serves documents from a directory called 'content.' It tries to identify and reasonably present contents of files of types pdf, plaintext, markdown, html, and standard image types.
'content/' could point to a directory hosted by Dropbox and anyone with write access to this directory may post content. Anyone with the URL of the server may view content. Dropbox is not required; any tool or service which allows one to synchronize a local directory to a remote one running Pillar should work.
% npm install pillar7 % cp -r ~/node_modules/pillar7 /where/I/want/to/run/pillar7.
% ssh www.myserver.com % cd /where/I/run/pillar/server % node pillar.ls (or npm start)
The server uses websocket.io to propogate name file update events back to the client browser so if you got you synchronization working between local content/ and remote content/. you should see the updated/new file move to the top of the page.
Long descriptive file names are modified to something which looks like a title or one line summary by replacing dashes, underscores and periods in the file name with spaces in the link text. so ...
is displayed as ...
http 2 request for comments
Article cache is now an ES6 map instead of an array.
Uses inotify.js instead of fs.watch to monitor changes to the content directory and maintain article cache. This allows us to distinguish between file modification and delete events without kicking off a rescan of the entire directory. Unfortunately inotify.js is linux specific Project is now linux specific on the backend as a result. :(
Upgraded from node.js V 0.12.7 to V 4.1.1 at the end of v1.0.5. Going forward I plan to allow myself the luxury of using ES6 specific enhancements.
This work is very loosely derived from Daniel Nill's wonderfully minimal
Thank you Daniel for helping me get past rough spots in my first socket.io project.
I was also inspired by Andrew Sliwinski's Simple (https://github.com/thisandagain/simple), an incredibly useful node remix of python's SimpleHTTPServer.
Thank you Camilo Aguilar for a directory monitoring solution which works! Node core team hint hint please consider Camilo implementation for the workings of fs.watch on linux. https://github.com/c4milo/node-inotify
Thank you Darren Overby for the concept and Nomad a What Coworking / Hacker Space http://www.nomadawhat.com/ for the coffee and big monitors.