Saturday, 8 April 2017

Express routing gives 404 for url's apart from localhost

My application currently serves fine making calls with Express, but I have a page now rendered by:

app.get('/user/:username', function(req, res){
  serve html page (no problems)
}

and from that page, I'm making a request for

return $http.get('/api/user/:s').success(function (resp) {
  stuff...
}

which is returning a 404 not found.

The call is in my Express app.js as

app.get('/api/user/:username', routes.api.getDBUser);

and I've been stumped on this problem for ages now. I feel like the issue is from something related to the URL.



via helpisgood

No comments:

Post a Comment