   destroy: (req, res) ->
     notFound res
 
-class APCtrl extends Ctrl
-  find: (req, res) ->
-    wifi.getAPDetails (cfg) ->
-      res.writeHead 200, @headers
-      res.end JSON.stringify cfg
+ap = new Ctrl url: '/ap'
+ap.findOne = (req, res) ->
+  wifi.getAPDetails (cfg) ->
+    res.writeHead 200, ap.headers
+    res.end JSON.stringify cfg
 
-ctrls = [
-  new APCtrl url: '/ap'
-]
+sta = new Ctrl url: '/sta'
+sta.findOne = (req, res) ->
+  wifi.getDetails (cfg) ->
+    res.writeHead 200, sta.headers
+    res.end JSON.stringify cfg
+
+ctrls = [ap, sta]
 
 app = (req, res) ->
   writeHead = res.writeHead
   res.writeHead = (statusCode, headers) ->
-    writeHead statusCode, headers
+    writeHead.call res, statusCode, headers
     res.headersSent = true
 
   write = res.write
   res.write = (data) ->
-    write = data
+    write.call res, data
+    res.headersSent = true
+
+  end = res.end
+  res.end = (data) ->
+    end.call res, data
     res.headersSent = true
 
   for ctrl in ctrls

http = require 'http'

class Ctrl
  headers:
    'Content-Type': 'application/json'

  matchUrl: (req) ->
    req.url == @url

        if @matchUrl req
          @destroy req, res

  create: (req, res) ->
    notFound res

