var restify = require('restify');

function respond(req, res, next) {
    res.send('何？！');
    next();
}

var server = restify.createServer({name: 'Game Lounge'});

server.get('/code-gen/', respond);
//server.head('/code-gen/', respond);

server.get(/.*/, restify.plugins.serveStatic({
    'directory': __dirname,
    'default': 'home.html'
}));

server.listen(8080, function() {
    console.log('%s listening at %s', server.name, server.url);
});

@@ -31,25 +31,248 @@
 ');%0A
-%0Afunction respond
+var CookieParser = require('restify-cookies');%0Aconst uuidv4 = require('uuid/v4');%0A%0Afunction checkCookie(req, res, next) %7B%0A    if (!req.cookies%5B'username'%5D) %7B%0A%09res.setCookie('username', uuidv4());%0A    %7D%0A    return next();%0A%7D%0A%0Afunction codeGen
 (req
@@ -304,19 +304,22 @@
 nd('
-%E4%BD%95%EF%BC%9F%EF%BC%81
+hehexD
 ');%0A    
 next
@@ -314,16 +314,23 @@
 ');%0A    
+return 
 next();%0A
@@ -394,57 +394,137 @@
 %7D);%0A
-%0A
 server.
-get('/code-gen/', respond);%0A
+use(CookieParser.parse); //restify cookie handler%0Aserver.use(checkCookie); 
 //
+our handler for verifying cookies%0A%0A
 server.
-head
+get
 ('/c
@@ -538,15 +538,15 @@
 /', 
-respond
+codeGen
 );%0A%0A

add a cookie handler that checks/creates cookies for users