Code Monkey home page Code Monkey logo

board's Introduction

Board-REST

  • Generate an API application with Rails 5
  • Setup RSpec testing framework with Factory Bot, Database Cleaner, Shoulda Matchers, pundit-matchersand Faker.
  • Build models and controllers with TDD (Test Driven Development).
  • Apply with JWT, pagination, API versioningand Serializers

This simple application contents four resources

  • User
    • Lists
      • Cards
        • Comments
          • Replies

Authentication system by adding the following service classes

  • JsonWebToken - Encode and decode jwt tokens
  • AuthorizeApiRequest - Authorize each API request
  • AuthenticateUser - Authenticate users
  • AuthenticationController - authentication process

User

Implement Single Table Inheritance (STI) For Member and Admin, Authorized users use pundit

Admin.new
=> #<Admin:0x007fec6b626088 id: nil, username: nil, email: nil, password_digest: nil, type: "Admin", created_at: nil, updated_at: nil>

Member.new
=> #<Member:0x007fec6b670368 id: nil, username: nil, email: nil, password_digest: nil, type: "Member", created_at: nil, updated_at: nil>

Comment

Create one Comment model with a polymorphic association. There will then be one column for “commentable_id”, which will store the ID of the object and then “commentable_type”, which will indicate what type of object (in this case, a Card or a Comment).

Prepare DB

application.yml have rails environment variables

mv config/application.yml config/application_example.yml

Create DBs

Run seed file to create member and admin user.

 rails db:create db:migrate db:seed

Test

bundle exec rspec

Failed All green!

board's People

Contributors

abeinoo avatar

Watchers

James Cloos avatar Mohamed Hegab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.