curl -H "Content-Type: application/json" -d '{ "auth":{"email": "luke@starwars.com","password": "12345678"}}' https://carlos-rails-api.herokuapp.com/user_token
curl https://carlos-rails-api.herokuapp.com/users
https://next-with-api-wbykqnmlyl.now.sh/
- Install rails
- Install postgresql
- Then:
git clone git@github.com:carlos-peru/rails-api.git
cd rails-api
rails db:migrate
rails s
Field | Description |
---|---|
id | The item's unique id. |
name | The user's name. Required. |
The user's email. Required. | |
password | At least 8 characters. Required. |
POST /user_token
{"auth": {"email": "USER_EMAIL", "password": "USER_PASSWORD"}}
201 Created
{"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"}
GET /users
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
GET /users/current
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
GET /users/USER_ID
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9
Content-Type: application/json
POST /users
{"user":{"name":"USER_NAME","email":"USER_EMAIL","password": "USER_PASSWORD","password_confirmation":"USER_PASSWORD"}}