New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create(Sign Up) a new user? #33
Comments
I found the reason. It should POST http://api.myapi2.dev/users. The URI /users/sign_up(.:format) is to request the sign up form page. _But_ there is a new issue. After I submit by click the Send button, it can create new user successfully in database, but Postman still result in errors. Why? |
You should post to the |
Yes, but the URI |
You can remove the devise routes, they are not being used |
I can't remove it directly. Because i add devise email confirmation for register.
The first one is need. Is there a way to remove the useless devise routes only? |
remove then the |
I just try it, it worked! Many thanks! |
I think the forms GET routes should remove too.
but retain the POST routes:
How can i do it? |
It has to be with the devise modules, maybe the |
Hi, from reading this I think one should link this issue with the following issue: #8 Seems that they're about the same things regarding devise routes an the apionrails user controller routes. Any idea how to solve the "duplicate" routes? As I understand we choose devise for the authentication stuff and won't get rid of it. Best Jan |
Yeah that, could be a good solution, not to use the A good solution would be as describe on issue #8 just move the |
@kurenn thanks for your reply :-) When I move the the devise_for :users call after the :api namespace the routes are listed beneath our :api path. Thats fine, but we do have duplicate routes now. When I bundle exec rspec spec all tests passes. Thats fine. Question: Devise don't return json responses when used as is. Shouldnt we inherit from the devise controllers? When I don't use the above "hack" (remove then the :registrable module from the user model) and try to use postman to create a user I'm getting "routing error - uninitialized constant Api::V1::RegistrationsController" due to the routes "mismatch" of our own and of the devise routes. My rake routes:
cancel_api_user_registration GET | /users/cancel(.:format) | api/v1/registrations#cancel {:format=>:json, :subdomain=>"api"} Question In future version one can image to use devise omniauth feature to register users with out api app that are google+ or twitter or etc. user. Best Jan |
@kurenn Also curious to @janotterstetter 's question. Could you help us out please? |
@janotterstetter Yeah you could use devise to register users, but you will have to override the registrations controller from devise to meet your needs, and on the tutorial I wanted to keep it super simple to register users. Now to get the users controller create action to work, using postman: Please let me know how it goes, sorry for the delay on the answer! |
I'm not sure how to test. I'm using localhost:3000, and none of my postman stuff works. Does this have to be loaded on a server to test the API? |
Do you have the subdomain setup on your routes file? |
Yes. |
That is why, you have to change that to respond to a path instead of an api as discussed in here #52 |
Thanks for getting back to me last time. I appreciate it. I took a crack at your ticket suggestion and implemented it in my routes as seen below. Now, I’m getting all kinds of timeouts and routing errors. I’m hoping that things are working as I go through, but I’m almost done with the book and have no idea if anything I’m doing is working on the API end, though the tests work great. I attached my log. What am I doing wrong here? Here is my routes require 'api_constraints' HapnApp::Application.routes.draw do mount SabisuRails::Engine => "/sabisu_rails" devise_for :users namespace :api, path: '/api' do
end All I really need to know at the end of this is:
I know this can’t be difficult once you learn it, but man, it seems a long way off. Thanks, Rich On Nov 26, 2015, at 7:01 PM, Abraham <notifications@github.commailto:notifications@github.com> wrote: That is why, you have to change that to respond to a path instead of an api as discussed in here #52#52 — |
@lesreaper Now you will have to access the resources like:
|
Why `Sign Up' is one GET methods? I test it in Postman, it result in errors.
I don't known how to get start. Please help.
But, I known how to create product, and it created successfully.
The text was updated successfully, but these errors were encountered: