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. (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...
});