generator-angular-fullstack
generator-angular-fullstack copied to clipboard
user.$save() error Not Found
Latest version of the stack.
Item | Answer |
---|---|
Transpiler | Babel |
HTML | |
CSS | |
Router | ui-router |
Build Tool | Grunt |
Client Tests | Jasmine / Mocha |
DB | MongoDB |
Auth | Y |
Hello, i am trying to save a user after changing the users role.. I am calling it like this:
user.$save()
but i get the following error in the console:
http://localhost:9000/api/users/572b9ba9f5c0ddc40df26058 404 (Not Found)
and in the error i get:
data: "Cannot POST /api/users/572b9b93f5c0ddc40df26056↵", status: 404, config: Object, statusText: "Not Found"
I am also using: user.$remove(); and that works fine.
Thanks,
Do you have an actual error object, with stack trace?
Like this?
angular.js:11756
POST http://localhost:9000/api/users/572b9b93f5c0ddc40df26057 404 (Not Found)(anonymous function) @ angular.js:11756
sendReq @ angular.js:11517
serverRequest @ angular.js:11227
processQueue @ angular.js:15961(anonymous function) @ angular.js:15977
Scope.$eval @ angular.js:17229
Scope.$digest @ angular.js:17045
Scope.$apply @ angular.js:17337
(anonymous function) @ angular.js:25023
defaultHandlerWrapper @ angular.js:3456
eventHandler @ angular.js:3444
administration.controller.js:29 Error Before
(anonymous function) @ administration.controller.js:29processQueue @ angular.js:15961
(anonymous function) @ angular.js:15977
Scope.$eval @ angular.js:17229Scope.$digest @ angular.js:17045Scope.$apply @ angular.js:17337
done @ angular.js:11572completeRequest @ angular.js:11778requestLoaded @ angular.js:11711
Or do you mean on the node side?
Does user.$save even exist somewhere? I looked through all of the user and server files and couldnt find anything related.
I was reading through other issues and found this one which states that you have to create your own endpoint for updating a user: https://github.com/angular-fullstack/generator-angular-fullstack/issues/954
If that is the case what is user.$save() supposed to do?
Thanks,
The User
class in an instance of an Angular Resource, which is where $save
comes from.
I'm looking more for an error on the Node side. What is 404
ing? the specific user? The user endpoint in general?
Ah ok.. Ive tried pretty much everything to get debugging working with this stack and brackets but no look so i resorted to console.log for troubleshooting everything on the node side.. Ive tried the user.$save with the seeded users and new users and its the same thing so im guessing its erroring on the endpoint. I am just trying to figure out where to put my console.log to get the error on the node side :) Thanks
If there is ever an error thrown, it should be shown in whatever console you're running your server from
Yeh nothing in the servers console.. just [0mPOST /api/users/572b....
Prob best if i create my own enpoint to do the update like you mentioned here: https://github.com/angular-fullstack/generator-angular-fullstack/issues/954
Oooohhh oh oh oh..... Yeah, the generator doesn't provide a PUT endpoint for users by default. We probably should.....
OK no probs.. I copied the change password one and changed it a little.. works great now.
Hi, I'm trying to accomplish this as well. Unfortunately, I've added the PUT endpoint, and modified auth.service.js, but can't get this working. Does anyone have any examples I can reference?