- git clone [email protected]:AlexAvlonitis/rails-5-api.git && cd rails-5-api
- bundle install
- copy .env.example file to .env and add required values
- rake db:setup
Request
curl -H "Content-Type: application/json" \
-X POST -d '{"email":"[email protected]","password":"12345678"}' \
http://localhost:3000/api/user/sign_up
Response Sign up success message and a JWT token
{
"message":"User created successfully",
"auth_token":"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4LCJleHAiOjE1MTQyMjYxMDN9.ADOGnYeexJpJj8SCHZHL_JFJ3iza9MmXTyWb8wGSFws"
}
Request
curl -H "Content-Type: application/json" \
-X POST -d '{"email":"[email protected]","password":"12345678"}' \
http://localhost:3000/api/user/sign_in
Response Login success message and a JWT token
{
"access_token":"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4LCJleHAiOjE1MTQyMjY0MjB9.u-6sECl-_GVj5JfE90ExGcGC5QR8xuJDh_FDbAFI7-w",
"message":"Login Successful"
}
Resquest Replace the Authorization token with a valid one, after sign_in or sign_up
curl -H "Content-Type: application/json" \
-H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4LCJleHAiOjE1MTQyMjcxMjF9.HRXFrrWU9ZRBCaYflOIAPskEcpNVcZQ7neGOwGTBqeM" \
-X GET http://localhost:3000/api/users
Response
[
{"email":"[email protected]"},
{"email":"[email protected]"},
{"email":"[email protected]"}
]
Rename/Personalize the application
rake rename[NewName]
- Add user sign up
- Add user sign in
- Add JWT authentication
- Add password reset feature
- Add password_confirmation field on Sign up
- Add email token-confirmation after Sign up
- Add Rack Attack gem, and configure it