nCore nCore - 4 months ago 24
AngularJS Question

mongoDB api endpoint

I'm using mongoDB to store data for my users and trying to create an api/users endpoint for the post method however everytime I post the form its giving me 404 api/users can't be found. How can I make the endpoint properly? been trying to follow a tutorial but the code just says app.post('api/db') but that's giving me 404, where's the api/ coming from?

my db collection looks like

movDB -- DB
- users (collection)
-- email, pass (collection objs)


submit controller with post method

$http.post('api/users/', vm.newUser).success(function(response){

}).error(function(error){
console.log(error);
})


server.js app.post

app.post('api/users/', authController.signup);

Answer

add '/' in your endpoint

app.post('/api/users/', authController.signup);