     res.end index
 
 http.createServer((req, res) ->
-    url_parts = url.parse(req.url, true)
+    res.setHeader "Access-Control-Allow-Origin", "*"
+    res.setHeader "Access-Control-Allow-Headers", "X-Requested-With, exlrequesttype"
+    url_parts = url.parse req.url, true
+    action = url_parts.pathname.split('/').pop()
     console.log url_parts
-    if url_parts.pathname is "/ids-for-id"
+    console.log action
+    if action is "ids-for-id"
         handle_ids_for_id(req, res, url_parts)
     else
         handle_default(req, res, url_parts)

  links.end()
  return

handle_ids_for_id = (req, res, url_parts) ->
    needle = url_parts.query.id
    console.log needle
    matches = mapping[needle] or []
    if matches.length > 0
        res.writeHead 200, "Content-Type": "application/json"
    else
        res.writeHead 404, "Content-Type": "application/json"
    ret = {
        "needle": needle,
        "matches": matches
    }
    res.end JSON.stringify(ret)


# !./node_modules/coffee-script/bin/coffee %

http = require("http")
csv = require("csv")
