var http = require('http');
var server = http.createServer(function (req, res) {
    if (req.method !== 'GET') {
        res.write('Send me an GET\n');
        res.end();
        return;
    }
    //console.log(req.url);
    var pathp = /^(https?:\/\/)?[a-zA-Z0-9\-.:]+(\/.+)$/;
    var um = pathp.exec(req.url);
    var path = um && um[2];
    if (!path && req.url[0] === '/') {
        path = req.url;
    }
    if (!path) {
        res.write('404 Not Found.\n');
        res.end();
        return;
    }
    var pqp = /^(.+)\?(.+)$/.exec(path);
    path = pqp[1];
    var query = pqp[2];
    //console.log(path);
    //console.log(query);
    if (path === '/api/unixtime') {
        var ump = /^iso=(.+)$/.exec(query);
        res.writeHead(200, {'Content-Type': 'application/json'});
        res.write(JSON.stringify({unixtime: new Date(ump[1].toLocaleString()).getTime()}));
        res.end();
    } else if (path === '/api/parsetime') {
        var uum = /^iso=(.+)$/.exec(query);
        var d = new Date(uum[1].toLocaleString());
        res.writeHead(200, {'Content-Type': 'application/json'});
        res.write(JSON.stringify({
            hour: d.getHours(),
            minute: d.getMinutes(),
            second: d.getSeconds()
        }));
        res.end();
    } else {
        res.write('400 Bad Request\n');
        res.end();
    }
});
server.listen(process.argv[2]);

@@ -21,16 +21,42 @@
 http');%0A
+var url = require('url');%0A
 var serv
@@ -252,120 +252,44 @@
 var 
-pathp = /%5E(https?:%5C/%5C/)?%5Ba-zA-Z0-9%5C-.:%5D+(%5C/.+)$/;%0A    var um = pathp.exec(req.url);%0A    var path = um && um%5B2%5D
+theUrl = url.parse(req.url, true)
 ;%0A
+%0A
     
@@ -297,81 +297,23 @@
 f (!
-path && req.url%5B0%5D === '/') %7B%0A        path = req.url;%0A    %7D%0A    if (!path
+theUrl.pathname
 ) %7B%0A
@@ -400,151 +400,27 @@
     
-var pqp = /%5E(.+)%5C?(.+)$/.exec(path);%0A    path = pqp%5B1%5D;%0A    var query = pqp%5B2%5D;%0A    //console.log(path);%0A    //console.log(query);%0A    if (path
+if (theUrl.pathname
  ===
@@ -461,32 +461,27 @@
 p = 
-/%5Eiso=(.+)$/.exec(query)
+theUrl.query%5B'iso'%5D
 ;%0A  
@@ -600,19 +600,16 @@
 Date(ump
-%5B1%5D
 .toLocal
@@ -667,20 +667,31 @@
 lse if (
-pa
 th
+eUrl.pathname
  === '/a
@@ -729,32 +729,27 @@
 m = 
-/%5Eiso=(.+)$/.exec(query)
+theUrl.query%5B'iso'%5D
 ;%0A  
@@ -778,11 +778,8 @@
 (uum
-%5B1%5D
 .toL

Use url model deal with the url.