title: Node js route not working,always shows cannot post
body: <p>I have referred few answers on stackoverflow too,but still not working. When i use app.post function in app.js with a function it works but when i put route inside it it doesnt work and postman says cannot post. It was working fine 1 day ago.<br>
  Here is the code of app.js</p>
  
  <pre><code>let express=require("express");
  let app=express();
  let signuproute=require("./routes/signup");
  app.listen(3000,function(req,res){
  console.log("server started");
  
  });
  
  app.get("/",function(req,res){
  
    console.log("home page called");
    res.send({message:"Thanks for calling home page"});
  });
  
  app.post("/signup",signuproute);
  </code></pre>
  
  <p>the above signup route doesnt work but when i directly pass the function in it like</p>
  
  <pre><code> app.post("/signup",function(req,res){ console.log("signed up"); });
  </code></pre>
  
  <p>It prints signed up on console. So Why does the route is not working.</p>
  
  <p>Here is my signed up route, signup.js:</p>
  
  <pre><code>let express=require('express');
  let router=express.Router();
  
  console.log("Signup called");
  router.get("/",function(req,res){
  
  });
  router.post("/",function(req,res,next){
  
    res.send({message:"thank you for signing up"});
  });
  module.exports=router;
  </code></pre>