This is an example of API based on Rails5 and CanCan which can be integrated with CASL. Read CASL and Cancan for details
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:
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.
rails s