Here is a sample code:
var x = require('./folder/usefile');
var Auth = passport.authenticate('jwt', { session: false });
module.exports = function(app){
console.log('inside function(app)'); //line executed!
var player = express.Router();
var finalRun = express.Router();
player.use('/usefile',player);
player.get('/', Auth, function(req, res){
console.log('inside get route');
x.login
});
player.post('/', Auth, function(req, res){
x.register});
finalRun.use('/api',finalRun);
}
In usefile
my login function is present which is exported.
I am using passport here, whose functionality is present in separate file here it is used only for authentication.
When I ran http://localhost:8080/api/usefile/---> for get
method, it is displaying 404. same for post
method.
The console is printed where I have mentioned line 2. It means my code is flowing till line 2.
Can anyone help me to find what mistake I have made here?
via Aditya Jain
No comments:
Post a Comment