 STATIC_URL = '/static'
 
 
-# Register DZI as XML
-express.static.mime.types.dzi = 'application/xml'
 app = require('streamline-express') express()
 
 # Template engine
 app.engine 'jade', jade.__express
 app.set 'view engine', 'jade'
+
 
 ## MIDDLEWARE:
 # (see http://www.senchalabs.org/connect/ for reference)

# favicon reqs are very common; respond to those immediately:
app.use express.favicon()   # will use default favicon since we don't specify

# Ser
app.use '/static', express.static STATIC_PATH

# otherwise, log all requests:

app.get '/content', (req, res, _) ->
    url = req.query?.url
    if not url?
        return res.json 400, {error: "Missing URL"}
    id = ++ID
    contentPath = path.join STATIC_PATH, "#{id}.jpg"
    writer = request(url).pipe fs.createWriteStream contentPath
    writer.on 'error', (err) ->
        return res.json 500, {error: err?.stack or err}
    writer.on 'finish', (_) ->
        deepzoom.create contentPath, _
        res.json 200, {id, url}
