Cleanup some uneeded debugging related comments.
This commit is contained in:
@ -3,26 +3,20 @@
|
||||
|
||||
function selectRoute(path, routes) {
|
||||
result = -1;
|
||||
console.log(path);
|
||||
var mPathComponents = path.split('/');
|
||||
routes.forEach((item, index) => {
|
||||
console.log(item);
|
||||
var mitem = item.split('/');
|
||||
if((mitem.length == mPathComponents.length)) {
|
||||
if((item.indexOf(':') > 0) && (path.endsWith('/') == false)) {
|
||||
console.log('we need parameters');
|
||||
var mmitem = item.substring(item.indexOf(':'));
|
||||
var mmpath = path.substring(item.indexOf(':'));
|
||||
var mmitemList = mmitem.split('/');
|
||||
var mmpathList = mmpath.split('/');
|
||||
if(mmitemList.length == mmpathList.length) {
|
||||
console.log('winner is here');
|
||||
if(result == -1) result = index;
|
||||
}
|
||||
} else {
|
||||
console.log('we do not need parameters');
|
||||
if(item == path) {
|
||||
console.log('winnere here');
|
||||
if(result == -1) result = index;
|
||||
}
|
||||
}
|
||||
@ -48,13 +42,6 @@ module.exports = class Router {
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
|
||||
/////////////////////////////////////
|
||||
console.log(selectRoute(path, this.routes));
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
var pathComponents = path.split('/');
|
||||
for (var i = 0; i < pathComponents.length; i++) {
|
||||
pathComponents[i] = '/' + pathComponents[i];
|
||||
|
Reference in New Issue
Block a user