Skip to content

Instantly share code, notes, and snippets.

@darr1s
Created August 20, 2017 13:45
Show Gist options
  • Save darr1s/b4513817308c59d4ffd390874ed9ca77 to your computer and use it in GitHub Desktop.
Save darr1s/b4513817308c59d4ffd390874ed9ca77 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::API
# Default to json response
respond_to :json
# Extensions initialization
include ActionController::Serialization
# Devise strong params
# before_action :configure_permitted_parameters, if: :devise_controller?
# protected
# def configure_permitted_parameters
# devise_parameter_sanitizer.permit(:sign_up) do |user_params|
# user_params.permit(:email, :password, :password_confirmation)
# user_params.permit({ roles: [] }, :email, :password, :password_confirmation)
# end
# end
end
~/Workspace/innovators-api on  master [✘!?] on 🐳 v17.06.0-ce took 5m 9s
➜ rails routes
Prefix Verb URI Pattern Controller#Action
rswag_ui /api-docs Rswag::Ui::Engine
rswag_api /api-docs Rswag::Api::Engine
new_user_session GET /api/v1/users/sign_in(.:format) devise/sessions#new
user_session POST /api/v1/users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /api/v1/users/sign_out(.:format) devise/sessions#destroy
new_user_password GET /api/v1/users/password/new(.:format) devise/passwords#new
edit_user_password GET /api/v1/users/password/edit(.:format) devise/passwords#edit
user_password PATCH /api/v1/users/password(.:format) devise/passwords#update
PUT /api/v1/users/password(.:format) devise/passwords#update
POST /api/v1/users/password(.:format) devise/passwords#create
cancel_user_registration GET /api/v1/users/cancel(.:format) devise/registrations#cancel
new_user_registration GET /api/v1/users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /api/v1/users/edit(.:format) devise/registrations#edit
user_registration PATCH /api/v1/users(.:format) devise/registrations#update
PUT /api/v1/users(.:format) devise/registrations#update
DELETE /api/v1/users(.:format) devise/registrations#destroy
POST /api/v1/users(.:format) devise/registrations#create
api_v1_clubs GET /api/v1/clubs(.:format) api/v1/clubs#index
POST /api/v1/clubs(.:format) api/v1/clubs#create
api_v1_club GET /api/v1/clubs/:id(.:format) api/v1/clubs#show
PATCH /api/v1/clubs/:id(.:format) api/v1/clubs#update
PUT /api/v1/clubs/:id(.:format) api/v1/clubs#update
DELETE /api/v1/clubs/:id(.:format) api/v1/clubs#destroy
api_v1_events GET /api/v1/events(.:format) api/v1/events#index
POST /api/v1/events(.:format) api/v1/events#create
api_v1_event GET /api/v1/events/:id(.:format) api/v1/events#show
PATCH /api/v1/events/:id(.:format) api/v1/events#update
PUT /api/v1/events/:id(.:format) api/v1/events#update
DELETE /api/v1/events/:id(.:format) api/v1/events#destroy
api_v1_galleries_images POST /api/v1/galleries/images(.:format) api/v1/images#create
api_v1_galleries_image DELETE /api/v1/galleries/images/:id(.:format) api/v1/images#destroy
api_v1_galleries GET /api/v1/galleries(.:format) api/v1/galleries#show
PATCH /api/v1/galleries(.:format) api/v1/galleries#update
PUT /api/v1/galleries(.:format) api/v1/galleries#update
DELETE /api/v1/galleries(.:format) api/v1/galleries#destroy
POST /api/v1/galleries(.:format) api/v1/galleries#create
Routes for Rswag::Ui::Engine:
root GET / rswag/ui/home#index
Routes for Rswag::Api::Engine:
~/Workspace/innovators-api on  master [✘!?] on 🐳 v17.06.0-ce
➜ rails s
=> Booting Puma
=> Rails 5.2.0.alpha application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.9.1 (ruby 2.4.1-p111), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:5000
Use Ctrl-C to stop
Started POST "/api/v1/users?email=test@test.com&password=[FILTERED]" for 127.0.0.1 at 2017-08-20 21:44:30 +0800
(0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by Devise::RegistrationsController#create as JSON
Parameters: {"email"=>"test@test.com", "password"=>"[FILTERED]", "registration"=>{}}
(0.1ms) BEGIN
(0.1ms) ROLLBACK
Completed 422 Unprocessable Entity in 15ms (Views: 0.8ms | ActiveRecord: 2.3ms)
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
mount Rswag::Ui::Engine => '/api-docs'
mount Rswag::Api::Engine => '/api-docs'
devise_for :users,
:path => '/api/v1/users'
# API version 1
api_version(:module => "Api::V1", :path => {:value => "api/v1"}) do
resources :clubs
resources :events
resource :galleries do
resources :images, :only => [:create, :destroy]
end
# devise_for :users,
# :as => :default,
# :controllers => {
# sessions: 'api/v1/users/sessions',
# registrations: 'api/v1/users/registrations',
# passwords: 'api/v1/users/passwords'
# }
# :path => '',
# :path_names => {
# sign_in: 'login',
# sign_up: 'register',
# sign_out: 'logout'
# }
end
# devise_scope :default_user do
# get :logout, :controller => :sessions, :action => :destroy
# end
end
class User < ApplicationRecord
devise :database_authenticatable, :registerable, :recoverable,
:trackable, :validatable,
:jwt_authenticatable, jwt_revocation_strategy: JWTBlacklist
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment