3
Create a brainfu*k program that can act like a simple server. It will be given a JSON representation of a file folder to serve from. It'll look something like this:
{
"something.html":"<!DOCTYPE html><html>...etc",
"styles.css":"#something{background-color:red...etc",
}
and, it will also be given the name of the file to return. No headers or anything, just output the text value of the file. It must output "404" if the file doesn't exist, though. The input will be the JSON, in 1 line, with the file name immediately after it:
{JSON DATA HERE}something.html
and the program will be run whenever a file is requested. So, I guess, it isn't really a server. But, this is brainfu*k, so it isn't perfect.
Apart from the lack of objective winning criteria (what's the goal? Code size? Votes? Just "getting it done" isn't enough)... how is brainfuck going to perform HTTP communication? It only has STDIN and STDOUT through which external libraries can communicate, but you haven't specified any. – John Dvorak – 2014-01-03T05:35:15.760
“the program will be run whenever a file is requested” – that sounds like it should be run from an internet super-server, like
inetd
orxinetd
. So for communication STDIN and STDOUT is just enough. But no idea how it could perform filesystem operations. – manatwork – 2014-01-03T09:06:42.910as I said, it isn't really a server (I know brainfu*k can't handle HTTP and the liking), it is simply passed a JSON object representing a filesystem and the name of the "file" to retrieve from that JSON object – markasoftware – 2014-01-03T17:14:44.960