Example to using path module:
var http = require("http"); var path = require("path"); http.createServer(function(request, response){ var dirname = path.dirname(decodeURI(request.url)); var basename = path.basename(decodeURI(request.url)); response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World! \n"); response.write("from mobile-web-app.blogspot.com \n"); response.write("dirname: " + dirname + "\n"); response.write("basename: " + basename + "\n"); response.end(); }).listen(8888);
No comments:
Post a Comment