[英]Can someone please tell me how to read the following: /\.(js)$/
I'm trying to understand some webserver code I found online and the part right after the "else if" is the only part I don't understand. 我试图了解一些我在网上找到的网络服务器代码,而“ else if”之后的部分是我唯一不了解的部分。 (I just started learning this stuff).
(我刚刚开始学习这些东西)。 Thanks
谢谢
var path = url.parse(req.url).pathname; // Managing the root route if (path == '/') { index = fs.readFile(__dirname+'/public/index.html', function(error,data) { //do stuff... }); // Managing the route for the javascript files } else if( /\\.(js)$/.test(path) ) { index = fs.readFile(__dirname+'/public'+path, function(error,data) { //do stuff... });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.