A Rails API made with json-serializer and jwt gem, primarily intended for demo of basic CRUD concepts and pagination
Routes
Prefix Verb URI Pattern
api_v1_users POST /api/v1/users(.:format)
api_v1_user GET /api/v1/users/:id(.:format)
PATCH /api/v1/users/:id(.:format)
PUT /api/v1/users/:id(.:format)
DELETE /api/v1/users/:id(.:format)
api_v1_orders GET /api/v1/orders(.:format)
POST /api/v1/orders(.:format)
api_v1_order GET /api/v1/orders/:id(.:format)
api_v1_tokens POST /api/v1/tokens(.:format)
$ bundle install
$ rake db:create && rake db:migrate
$ rails test --pride
$rake db:seed
~~bash $ curl -X POST --data "user[email]=new@email.com" --data "user[password]=test1234" http://localhost:3000/api/v1/users
Response: {"data":{"id":"10","type":"user","attributes":{"email":"new@email.com"},"relationships":{"products":{"data":[]}}}}
$ curl -X POST --data "user[email]=new@email.com" --data "user[password]=test1234" http://localhost:3000/api/v1/tokens
$ curl --header "Authorization = token here" http://localhost:3000/api/v1/products
- Ruby 2.7+(Rails 6.1.x)
- Sqlite3