Last active
August 29, 2015 14:23
-
-
Save x-bart/6c518f6f4c021db6a568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = require('express')() | |
exec = require('child_process').exec | |
fs = require 'fs' | |
app.get "*", (req, resp) -> | |
file = "." + req.url | |
if fs.existsSync file | |
exec "coffee #{file}", (err, stdout, stderr) -> | |
if err? | |
resp.status(500).send err | |
else if stderr? && stderr isnt "" | |
resp.status(400).send stderr | |
else | |
resp.status(200).send stdout | |
resp.end() | |
else | |
resp.status(404).end "404 Not Found" | |
app.listen 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment