/**
 * Created by yuech on 1/29/2017.
 */
/**
 * Created by yuech on 1/28/2017.
 */
var http = require('http');
var fs = require('fs');
var express = require('express');
var app = express();
var path = require('path');

app.use(express.static('public'));
//Lets define a port we want to listen to
const PORT=3000;

//We need a function which handles requests and send response
function handleRequest(req, res){
    var url = req.url;
    console.log("dirname: "+path.join(__dirname,url));
    //console.log(url);
    switch(req.method)
    {
        case 'GET':
            //console.log("get method");
            if (url == '/') {
                //console.log("slash");
                renderFile(res, path.join(__dirname,'video.html'));
            }
            else if(url == '/upload.html'){
                console.log("option");
                renderFile(res, path.join(__dirname,'upload.html'));
            }
            // else if (url == '/login') {console.log(path.join(__dirname, 'public','login.html'));renderFile(res, path.join(__dirname,'public','login.html'));console.log('read file end');}
            // else if (url == '/register') renderFile(res, path.join(__dirname,'public','register.html'));
            else renderFile(res, path.join(__dirname, url));
            break;
        default:
            console.log('method has not according solution');
    }}

function renderFile(res, file)
{
    console.log('render file');
    fs.readFile(file, function(err, data){
        if(err)
        {
            res.writeHead(404);
            res.write('File Not Found');
        }
        else
        {
            res.writeHead(200);
            res.write(data);
        }
        res.end();
    });
}
//Create a server
var server = http.createServer(handleRequest);

//Lets start our server
server.listen(PORT, function(){
    //Callback triggered when server is successfully listening. Hurray!
    console.log("Server listening on: http://localhost:%s", PORT);
});

@@ -427,16 +427,45 @@
 eq.url;%0A
+    var method = req.method;%0A
     cons
@@ -511,26 +511,24 @@
 ,url));%0A    
-//
 console.log(
@@ -527,19 +527,22 @@
 ole.log(
-url
+method
 );%0A    s
@@ -786,24 +786,26 @@
             
+/*
 else if(url 
@@ -938,32 +938,47 @@
 ;%0A            %7D%0A
+            */%0A
             // e
@@ -1251,32 +1251,32 @@
 gister.html'));%0A
-
             else
@@ -1316,24 +1316,133 @@
 ame, url));%0A
+            break;%0A        case 'POST':%0A            if (url=='url')%7B%0A                req.data%0A            %7D%0A%0A
             

Update vserver.js