A web server… ran in the browser. Edit the code in server.js to write out to the response stream. You can view responses by clicking the “View It” button, which will supply a URL accessible anywhere on the interwebs (as long as you keep your browser open which is running the server).
All files are built as modules where you must export variables that you want to expose in “exports”. To use those variables from other files simply require that file by name. There cannot be two files with the same name. To edit the file name click on the file name while the tab is active. This was envisioned to be a tool for front end developers to mock requests from a web server without the pain of provisioning a web server.
Okay- time for the mind blowing feature that didn’t make it into the project. Use node as a load balancer to many clients running identical client “apps”. This would simulate multiple head ends in a server farm by simply having many users hit Mocker and load up a shared application. Instant cloud. I can’t think of any reason people actually need this, but its a cool idea. I wanted to get this in for the competition, but I figured it was better to deliver features that worked as opposed to something that has questionable functionality.
When you load the page, your server is instantly running.
Click “View It” and another window will open with a GUID which will serve the “hello world” route. This URL can be shared with anyone on the internet, and as long as you keep your browser tab open they will receive the response your code is executing.
Change the text of “hello world” and click “View It” again. This shows the response is being ran on the client, rather than code interpreted back on server.
Change the URL of the second page to /GUID/home/ryan . This will get to the Ryan route defined in server.js
Play around with the code… but always remember to call response.end(). The routes object will call it for you on the callback.
Pretty sure this doesn’t work at all in IE (but I kinda like that).
Underscore Backbone Express Socket.io CodeMirror JQuery UUID
Voting is now closed.







(8)
therazorbladeThanks for the review! It the code ran completely in the browser. All node is doing is connecting to the browsers (via socket.io) and sending the request to the client. It is the clients responsibility to return the response stream. The code is ran completely in the client by calling eval() in a very controlled sandbox’d approach. This is how you can change the code in the editor and see the response stream change on the fly the next time you hit “View It”.
My routes implementation uses the routes logic in the “routes.js” file. This was written and checked-in during the last hour of the competition. Subsequently there is a bug where getting to the other route is non-intuitive. If you go to /guid/home/ryan , the server will key into the other route I have for an example.
A quick note to the reply. Eval is not called on every request, only when the code is changed and someone either clicks “Save” or “View It”. Only then are the files in the text editor named-spaced and loaded into the client runtime as functions.
therazorbladeUpdated my vote and review.
ericfloThis is a really, really cool idea. I’ve been fascinated by ideas like this ever since coming across this PTTH wiki page: http://wiki.secondlife.com/wiki/Reverse_HTTP and what you’ve done is implement it on top of existing web technologies. I think this entry will blow a lot of people’s minds, in a good way :) | |||
purincessI really like the concept — this opens up a whole range of possibilities. I wish to see the use cases better realized and illustrated. | |||
mdp
cramforceVery cool prototyping idea. | |||
Thank you for your judgements! I had some bigger ideas for this project which I hope to continue to deliver, but this was really just a prototype of an idea to build other things on top of. I’m glad you understood my concept!
jerrysievertvery interesting — has a lot of potential. not sure if the syntax error i introduced caused it to no longer work, or if it was just coincidence. | |||
Thanks for the positive marks! The JS error probably did break it… I was able to implement the system to where a JS error wouldn’t crash the execution of the server by sandbox-ing every new eval’d block. Unfortunately I ran out of time to really gracefully provide enough feedback about JS errors and the UI implies everything’s okay. In other words, my system knows when they happen, it just doesn’t do much about it.
A head-scratching idea, and a working implementation, :D Although the proxy is weird sometimes, I often got unexpected “Cannot get …” errors. This entry makes me wonder if it would be possible to emulate nodejs modules on the client. Fake filesystem, network through proxy and etc. :) | |||
Sorry about those errors. I added the routes.js in the last hour of the contest (true to my teams name). The second route only works if you hit /GUID/home/ryan , which I know is confusing.
Thanks for the good “inovation” score. This was honestly just an idea I had so I can hack with peeps at the knockout. I feel it turned out okay, but I definitely see with some proper enhancements it can be a viable tool.
Nice implementation has potential to be a really useful tool. | |||
An interesting idea. The keyboard navigation in the editor annoys me, could be improved. | |||
the idea is neat, but i don’t see myself using it. | |||
fredyatesiv
Nicely done! Why do I need to save changes? Why not just make it work dynamically?