Skip to content

Commit ec595cc

Browse files
committed
feat: add login route and namespace API v1
1 parent a56599b commit ec595cc

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

app/controllers/sessions_controller.rb renamed to app/controllers/api/v1/sessions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class SessionsController < ApplicationController
1+
class Api::V1::SessionsController < ApplicationController
22
def create
33
user = User.find_by(email: params[:email])
44
if user&.authenticate(params[:password])

config/routes.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77

88
# Defines the root path route ("/")
99
# root "posts#index"
10+
namespace :api do
11+
namespace :v1 do
12+
post '/login', to: 'sessions#create'
13+
end
14+
end
1015
end

0 commit comments

Comments
 (0)