Skip to content

Instantly share code, notes, and snippets.

@cmdr-rohit-bang
Last active February 8, 2021 05:22
Show Gist options
  • Save cmdr-rohit-bang/dede475af8c847f57c2996a63b4baa9a to your computer and use it in GitHub Desktop.
Save cmdr-rohit-bang/dede475af8c847f57c2996a63b4baa9a to your computer and use it in GitHub Desktop.
API Integration in Project

Use the below command to create "API Only" project.

rails new my_api_project --api

Install JWT Gem

gem 'jwt'

Put the application controller in app/controllers/

application_controller.rb

In your /app/controllers/api/v1/users_controller.rb

# Project API users controller module
module Api
  module V1
    # Project API users controller class
    class UsersController < ApplicationController
      before_action :authorized, only: %i[update logout]
      
      # Login function
      def login
      # your code goes here
      end
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment