Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.1 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.1 KB

Rails 5 REST API with CanCan

This is an example of API based on Rails5 and CanCan which can be integrated with CASL. Read CASL and Cancan for details

Installation

If you don't have Ruby, install it (e.g., by using rvm and when you finish, just run this:

gem install bundler
bundle install

Then configure database (it uses sqlite3 by default) in config/databse.yml and run migrations and seeds:

rails db:migrate
rails db:seed

Seeds adds 2 users:

API

To login send:

POST /api/session

{
  "email": "admin@freaksidea.com", # or member@freaksidea.com
  "password": "123456"
}

The response will give back JWT token and a list of rules which can be read by CASL

Run rails routes to see the full list of routes. articles and users follows the general REST CRUD scheme.

Run Server

rails s