Ko38 / Stock-Overflow

0 stars 0 forks source link

Stock Overflow README

Stock Overflow is a place where developers could ask and answer questions related to coding.

alt text

Stock Overflow is a Stack Overflow Clone.

Features

Technologies

BCrypt

Used BCrypt for encrypting users' passwords.

def password=(password)
    @password = password
    self.password_digest = BCrypt::Password.create(password)
  end

def is_password?(password)
  BCrypt::Password.new(self.password_digest).is_password?(password)
end

Redux workflow

Used all the essential parts of Redux such as reducers and thunk.

import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk';
import rootReducer from './reducers/root_reducer'

const configureStore = (preloadedState = {}) => {
  return createStore(rootReducer, preloadedState, applyMiddleware(thunk));
};

export default configureStore;

Active Record

Used Active Record for making migrations. Active Record represents the models of the program. The layer of the system responsible for data and logic.

class CreateUsers < ActiveRecord::Migration[5.2]
  def change
    create_table :users do |t|
      t.string :username, null: false
      t.string :password_digest, null: false
      t.string :session_token, null: false  
      t.string :email, null: false
      t.timestamps
    end

    add_index :users, :username, unique: true
    add_index :users, :session_token, unique: true
    add_index :users, :email, unique: true
  end
end