diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss
new file mode 100644
index 0000000..f986bd4
--- /dev/null
+++ b/app/assets/stylesheets/sessions.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss
new file mode 100644
index 0000000..aaf17f7
--- /dev/null
+++ b/app/assets/stylesheets/users.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 0000000..710db28
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,10 @@
+class SessionsController < ApplicationController
+ def new
+ end
+
+ def create
+ end
+
+ def welcome
+ end
+end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
new file mode 100644
index 0000000..0d7fd54
--- /dev/null
+++ b/app/controllers/users_controller.rb
@@ -0,0 +1,10 @@
+class UsersController < ApplicationController
+ def new
+ end
+
+ def create
+ @user = User.create(params.require(:user).permit(:username, :password))
+ session[:user_id] = @user.id
+ redirect_to '/welcome'
+ end
+end
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
new file mode 100644
index 0000000..309f8b2
--- /dev/null
+++ b/app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
new file mode 100644
index 0000000..2310a24
--- /dev/null
+++ b/app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 0000000..d67da20
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,3 @@
+class User < ApplicationRecord
+ has_secure_password
+end
diff --git a/app/views/sessions/create.html.erb b/app/views/sessions/create.html.erb
new file mode 100644
index 0000000..c251174
--- /dev/null
+++ b/app/views/sessions/create.html.erb
@@ -0,0 +1,2 @@
+
Sessions#create
+Find me in app/views/sessions/create.html.erb
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
new file mode 100644
index 0000000..b39a3bc
--- /dev/null
+++ b/app/views/sessions/new.html.erb
@@ -0,0 +1,2 @@
+Sessions#new
+Find me in app/views/sessions/new.html.erb
diff --git a/app/views/sessions/welcome.html.erb b/app/views/sessions/welcome.html.erb
new file mode 100644
index 0000000..c63e0c1
--- /dev/null
+++ b/app/views/sessions/welcome.html.erb
@@ -0,0 +1,3 @@
+Welcome
+<%= button_to "Login", '/login', method: :get%>
+<%= button_to "Sign Up", '/users/new', method: :get%>
\ No newline at end of file
diff --git a/app/views/users/create.html.erb b/app/views/users/create.html.erb
new file mode 100644
index 0000000..48ea02e
--- /dev/null
+++ b/app/views/users/create.html.erb
@@ -0,0 +1,2 @@
+Users#create
+Find me in app/views/users/create.html.erb
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
new file mode 100644
index 0000000..ac34536
--- /dev/null
+++ b/app/views/users/new.html.erb
@@ -0,0 +1,8 @@
+Sign Up
+<%= form_for @user do |f|%>
+ <%= f.label :username%>
+ <%= f.text_field :username%>
+ <%= f.label :password%>
+ <%= f.password_field :password%>
+ <%= f.submit %>
+<%end%>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index af3f220..4e90759 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,7 @@
Rails.application.routes.draw do
+ resources :users, only: [:new, :create]
+ get 'login', to: 'sessions#new'
+ post 'login', to: 'sessions#create'
+ get 'welcome', to: 'sessions#welcome'
resources :books
end
diff --git a/db/migrate/20210320130542_create_users.rb b/db/migrate/20210320130542_create_users.rb
new file mode 100644
index 0000000..1fe81e6
--- /dev/null
+++ b/db/migrate/20210320130542_create_users.rb
@@ -0,0 +1,10 @@
+class CreateUsers < ActiveRecord::Migration[6.1]
+ def change
+ create_table :users do |t|
+ t.string :username
+ t.string :password_digest
+
+ t.timestamps
+ end
+ end
+end
diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb
new file mode 100644
index 0000000..d8e9bf6
--- /dev/null
+++ b/test/controllers/sessions_controller_test.rb
@@ -0,0 +1,18 @@
+require "test_helper"
+
+class SessionsControllerTest < ActionDispatch::IntegrationTest
+ test "should get new" do
+ get sessions_new_url
+ assert_response :success
+ end
+
+ test "should get create" do
+ get sessions_create_url
+ assert_response :success
+ end
+
+ test "should get welcome" do
+ get sessions_welcome_url
+ assert_response :success
+ end
+end
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
new file mode 100644
index 0000000..c6a205d
--- /dev/null
+++ b/test/controllers/users_controller_test.rb
@@ -0,0 +1,13 @@
+require "test_helper"
+
+class UsersControllerTest < ActionDispatch::IntegrationTest
+ test "should get new" do
+ get users_new_url
+ assert_response :success
+ end
+
+ test "should get create" do
+ get users_create_url
+ assert_response :success
+ end
+end
diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml
new file mode 100644
index 0000000..d34cad0
--- /dev/null
+++ b/test/fixtures/users.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ username: MyString
+ password_digest: MyString
+
+two:
+ username: MyString
+ password_digest: MyString
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
new file mode 100644
index 0000000..5c07f49
--- /dev/null
+++ b/test/models/user_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end