Create a server in Brainfu*k

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.

markasoftware

Posted 2014-01-02T22:32:45.987

Reputation: 346

Question was closed 2014-01-03T06:15:47.643

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 or xinetd. So for communication STDIN and STDOUT is just enough. But no idea how it could perform filesystem operations. – manatwork – 2014-01-03T09:06:42.910

as 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

No answers