Ruby 2.6.7
Rails 5.2.6
Postgres 12
cp config/database.example.yml database.yml
rails db:create && rails db:migrate
rails dev:fake_data
test user account.
email: test@test.com
password: test12345
/api/v1/login
curl -d '{"email":"test@test.com", "password":"password"}' -H "Content-Type: application/json" -X POST http://localhost:3000/api/v1/login
{
"auth_token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE2MzQ1MzE4MzR9.B25_fZ8neon0R1b5JIfIaCm6a6E7ew3UUUQvqNek_bM",
"status": "ok"
}
/api/v1/purchases
curl -d '{"course_id": 8}' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE2MzQ1MzQ0NDl9.q5ZeNtBkpml6qVpStrTaJioAQB_91Q1XGaN3vOVnM6g" -X POST http://localhost:3000/api/v1/purchases
Purchasing course successfully.
{"message":"Purchasing course successfully","status":"created"}
if without parameters will got below error.
{"error":"course_id is missing"}
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE2MzQ1MzgwODN9.j41bdRXIIWk8copTBT1f50lEgHeN0hGrEnpCYTKSy8E" -X GET http://localhost:3002/api/v1/purchases?category_id=2&avaiabled=1
admin@test.com
admin12345
http://localhost:3000/login
http://localhost:3000/admin/
or
http://localhost:3002/admin/courses
http://localhost:3000/admin/courses/new
http://localhost:3002/admin/courses/[slug]/edit