angularjs - 404 not found on API route for MEAN application? -
in application when 1 of forms submitted, function called...
$scope.submit = function() { $scope.message = ""; var params = { ... }; subscriber.create(params) .success(function(data) { ... }); };
which in turn calls subfactory create method, posts '/mail'.
subfactory.create = function(subdata) { return $http.post('/mail', subdata); };
upon attempting post '/mail' error post http://localhost:8080/mail 404 (not found)
. cannot figure out how resolve because have this...
apirouter.route('/mail') .post(function(req, res) { ... });
and far i'm aware should able find '/mail'. full apirouter located here, , full server.js file located here.
when setup api routes in server.js, routed /api
, routes added router begin there. therefore, /mail
route located @ /api/mail
server.js
// routes // ======== // api route // ------------- var apiroutes = require('./app/routes/api')(app, express); app.use('/api', apiroutes);
./app/routes/api
apirouter.route('/mail') .post(function(req, res) {