How to resolve error routing missing path?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm following this tutorial



I have a folder routes in which there are two sub folders users and home and each folder contains two js files naming index.js each.
But on running my main server.js file I am getting this error:-




Error
test
C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737
throw new Error(msgs.join(' ') || 'Unknown error');
^




Error: Route missing path
at Object.exports.assert (C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737:11)
at new module.exports.internals.Route (C:UsersuserDesktopsocial_networknode_moduleshapilibroute.js:40:10)
at module.exports.internals.Connection.internals.Connection._addRoute (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:387:19)
at module.exports.internals.Connection.internals.Connection._route (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:379:18)
at module.exports.internals.Plugin.internals.Plugin._apply (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:572:14)
at module.exports.internals.Plugin.internals.Plugin.route (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:542:10)
at Object.module.exports.register (C:UsersuserDesktopsocial_networkrouteshomeindex.js:3:12)
at Object.target [as register] (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesjoilibobject.js:79:30)
at each (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:317:14)
at iterate (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:36:13)
at Object.exports.serial (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:39:9)
at module.exports.internals.Server.internals.Plugin.register (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:320:11)
at Object.<anonymous> (C:UsersuserDesktopsocial_networkserver.js:73:8)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)


It seems like there is problem in route of home because users files are working properly because when I don't comment that part server.register of home only then it shows error
This is my server.js file code:-



const Hapi=require("hapi");
const server=new Hapi.Server();
server.connection({port:2000});
server.start(console.log("test"));
const mongoose = require("mongoose");
const node_connect_db=mongoose.connect("mongodb://test:test456@ds149034.mlab.com:49034/node_connect1");
const User=require("./database_models/user_model");

server.route({
method:"GET",
path:"/",
handler:function(request,reply){
reply.view("landing.ejs");
}
})
server.register(require("vision"),function(err){
server.views({
engines:{
ejs:require("ejs")
},
relativeTo:__dirname,
path:"views"
})
});
server.register(require("inert"),function(err){
});
server.register(require("hapi-auth-cookie"));
server.auth.strategy("simple-cookie-strategy","cookie",{
cookie:"node_connect_cookie",
password:"abcdefghabcdefghabcdefghabcdefgh",
isSecure:false
})
server.register({
register:require("./routes/users")
},function(err)
{ if(err){
return;
}
});



server.register({
register:require("./routes/home")
},function(err)
{ if(err){
return;
}

});
server.route({
method:"GET",
path:"/{param*}",
handler:{
directory:{
path:"public"
}
}
})


>Also this is my home/index.js code:-


module.exports.register = function(plugin,options,next){
plugin.route([
{
method:"GET",
url:"/home",
hander:function(request,reply){
console.log("HIII");
reply("home");
}
}

])


next();
}
module.exports.register.attributes = {
pkg:require("./package.json")
};









share|improve this question































    0















    I'm following this tutorial



    I have a folder routes in which there are two sub folders users and home and each folder contains two js files naming index.js each.
    But on running my main server.js file I am getting this error:-




    Error
    test
    C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737
    throw new Error(msgs.join(' ') || 'Unknown error');
    ^




    Error: Route missing path
    at Object.exports.assert (C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737:11)
    at new module.exports.internals.Route (C:UsersuserDesktopsocial_networknode_moduleshapilibroute.js:40:10)
    at module.exports.internals.Connection.internals.Connection._addRoute (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:387:19)
    at module.exports.internals.Connection.internals.Connection._route (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:379:18)
    at module.exports.internals.Plugin.internals.Plugin._apply (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:572:14)
    at module.exports.internals.Plugin.internals.Plugin.route (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:542:10)
    at Object.module.exports.register (C:UsersuserDesktopsocial_networkrouteshomeindex.js:3:12)
    at Object.target [as register] (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesjoilibobject.js:79:30)
    at each (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:317:14)
    at iterate (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:36:13)
    at Object.exports.serial (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:39:9)
    at module.exports.internals.Server.internals.Plugin.register (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:320:11)
    at Object.<anonymous> (C:UsersuserDesktopsocial_networkserver.js:73:8)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)


    It seems like there is problem in route of home because users files are working properly because when I don't comment that part server.register of home only then it shows error
    This is my server.js file code:-



    const Hapi=require("hapi");
    const server=new Hapi.Server();
    server.connection({port:2000});
    server.start(console.log("test"));
    const mongoose = require("mongoose");
    const node_connect_db=mongoose.connect("mongodb://test:test456@ds149034.mlab.com:49034/node_connect1");
    const User=require("./database_models/user_model");

    server.route({
    method:"GET",
    path:"/",
    handler:function(request,reply){
    reply.view("landing.ejs");
    }
    })
    server.register(require("vision"),function(err){
    server.views({
    engines:{
    ejs:require("ejs")
    },
    relativeTo:__dirname,
    path:"views"
    })
    });
    server.register(require("inert"),function(err){
    });
    server.register(require("hapi-auth-cookie"));
    server.auth.strategy("simple-cookie-strategy","cookie",{
    cookie:"node_connect_cookie",
    password:"abcdefghabcdefghabcdefghabcdefgh",
    isSecure:false
    })
    server.register({
    register:require("./routes/users")
    },function(err)
    { if(err){
    return;
    }
    });



    server.register({
    register:require("./routes/home")
    },function(err)
    { if(err){
    return;
    }

    });
    server.route({
    method:"GET",
    path:"/{param*}",
    handler:{
    directory:{
    path:"public"
    }
    }
    })


    >Also this is my home/index.js code:-


    module.exports.register = function(plugin,options,next){
    plugin.route([
    {
    method:"GET",
    url:"/home",
    hander:function(request,reply){
    console.log("HIII");
    reply("home");
    }
    }

    ])


    next();
    }
    module.exports.register.attributes = {
    pkg:require("./package.json")
    };









    share|improve this question



























      0












      0








      0








      I'm following this tutorial



      I have a folder routes in which there are two sub folders users and home and each folder contains two js files naming index.js each.
      But on running my main server.js file I am getting this error:-




      Error
      test
      C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737
      throw new Error(msgs.join(' ') || 'Unknown error');
      ^




      Error: Route missing path
      at Object.exports.assert (C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737:11)
      at new module.exports.internals.Route (C:UsersuserDesktopsocial_networknode_moduleshapilibroute.js:40:10)
      at module.exports.internals.Connection.internals.Connection._addRoute (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:387:19)
      at module.exports.internals.Connection.internals.Connection._route (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:379:18)
      at module.exports.internals.Plugin.internals.Plugin._apply (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:572:14)
      at module.exports.internals.Plugin.internals.Plugin.route (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:542:10)
      at Object.module.exports.register (C:UsersuserDesktopsocial_networkrouteshomeindex.js:3:12)
      at Object.target [as register] (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesjoilibobject.js:79:30)
      at each (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:317:14)
      at iterate (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:36:13)
      at Object.exports.serial (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:39:9)
      at module.exports.internals.Server.internals.Plugin.register (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:320:11)
      at Object.<anonymous> (C:UsersuserDesktopsocial_networkserver.js:73:8)
      at Module._compile (internal/modules/cjs/loader.js:689:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)


      It seems like there is problem in route of home because users files are working properly because when I don't comment that part server.register of home only then it shows error
      This is my server.js file code:-



      const Hapi=require("hapi");
      const server=new Hapi.Server();
      server.connection({port:2000});
      server.start(console.log("test"));
      const mongoose = require("mongoose");
      const node_connect_db=mongoose.connect("mongodb://test:test456@ds149034.mlab.com:49034/node_connect1");
      const User=require("./database_models/user_model");

      server.route({
      method:"GET",
      path:"/",
      handler:function(request,reply){
      reply.view("landing.ejs");
      }
      })
      server.register(require("vision"),function(err){
      server.views({
      engines:{
      ejs:require("ejs")
      },
      relativeTo:__dirname,
      path:"views"
      })
      });
      server.register(require("inert"),function(err){
      });
      server.register(require("hapi-auth-cookie"));
      server.auth.strategy("simple-cookie-strategy","cookie",{
      cookie:"node_connect_cookie",
      password:"abcdefghabcdefghabcdefghabcdefgh",
      isSecure:false
      })
      server.register({
      register:require("./routes/users")
      },function(err)
      { if(err){
      return;
      }
      });



      server.register({
      register:require("./routes/home")
      },function(err)
      { if(err){
      return;
      }

      });
      server.route({
      method:"GET",
      path:"/{param*}",
      handler:{
      directory:{
      path:"public"
      }
      }
      })


      >Also this is my home/index.js code:-


      module.exports.register = function(plugin,options,next){
      plugin.route([
      {
      method:"GET",
      url:"/home",
      hander:function(request,reply){
      console.log("HIII");
      reply("home");
      }
      }

      ])


      next();
      }
      module.exports.register.attributes = {
      pkg:require("./package.json")
      };









      share|improve this question
















      I'm following this tutorial



      I have a folder routes in which there are two sub folders users and home and each folder contains two js files naming index.js each.
      But on running my main server.js file I am getting this error:-




      Error
      test
      C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737
      throw new Error(msgs.join(' ') || 'Unknown error');
      ^




      Error: Route missing path
      at Object.exports.assert (C:UsersuserDesktopsocial_networknode_moduleshapinode_moduleshoeklibindex.js:737:11)
      at new module.exports.internals.Route (C:UsersuserDesktopsocial_networknode_moduleshapilibroute.js:40:10)
      at module.exports.internals.Connection.internals.Connection._addRoute (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:387:19)
      at module.exports.internals.Connection.internals.Connection._route (C:UsersuserDesktopsocial_networknode_moduleshapilibconnection.js:379:18)
      at module.exports.internals.Plugin.internals.Plugin._apply (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:572:14)
      at module.exports.internals.Plugin.internals.Plugin.route (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:542:10)
      at Object.module.exports.register (C:UsersuserDesktopsocial_networkrouteshomeindex.js:3:12)
      at Object.target [as register] (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesjoilibobject.js:79:30)
      at each (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:317:14)
      at iterate (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:36:13)
      at Object.exports.serial (C:UsersuserDesktopsocial_networknode_moduleshapinode_modulesitemslibindex.js:39:9)
      at module.exports.internals.Server.internals.Plugin.register (C:UsersuserDesktopsocial_networknode_moduleshapilibplugin.js:320:11)
      at Object.<anonymous> (C:UsersuserDesktopsocial_networkserver.js:73:8)
      at Module._compile (internal/modules/cjs/loader.js:689:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)


      It seems like there is problem in route of home because users files are working properly because when I don't comment that part server.register of home only then it shows error
      This is my server.js file code:-



      const Hapi=require("hapi");
      const server=new Hapi.Server();
      server.connection({port:2000});
      server.start(console.log("test"));
      const mongoose = require("mongoose");
      const node_connect_db=mongoose.connect("mongodb://test:test456@ds149034.mlab.com:49034/node_connect1");
      const User=require("./database_models/user_model");

      server.route({
      method:"GET",
      path:"/",
      handler:function(request,reply){
      reply.view("landing.ejs");
      }
      })
      server.register(require("vision"),function(err){
      server.views({
      engines:{
      ejs:require("ejs")
      },
      relativeTo:__dirname,
      path:"views"
      })
      });
      server.register(require("inert"),function(err){
      });
      server.register(require("hapi-auth-cookie"));
      server.auth.strategy("simple-cookie-strategy","cookie",{
      cookie:"node_connect_cookie",
      password:"abcdefghabcdefghabcdefghabcdefgh",
      isSecure:false
      })
      server.register({
      register:require("./routes/users")
      },function(err)
      { if(err){
      return;
      }
      });



      server.register({
      register:require("./routes/home")
      },function(err)
      { if(err){
      return;
      }

      });
      server.route({
      method:"GET",
      path:"/{param*}",
      handler:{
      directory:{
      path:"public"
      }
      }
      })


      >Also this is my home/index.js code:-


      module.exports.register = function(plugin,options,next){
      plugin.route([
      {
      method:"GET",
      url:"/home",
      hander:function(request,reply){
      console.log("HIII");
      reply("home");
      }
      }

      ])


      next();
      }
      module.exports.register.attributes = {
      pkg:require("./package.json")
      };






      node.js hapi






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 4 at 6:50









      Wojciech Wirzbicki

      1,61811426




      1,61811426










      asked Jan 4 at 6:32









      VertikaVertika

      12




      12
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034061%2fhow-to-resolve-error-routing-missing-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54034061%2fhow-to-resolve-error-routing-missing-path%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas