
Learn to build a professional API server with Ruby on Rails 5, implement API authentication and Facebook login, fetch user data from Facebook, and customize JSON responses.
Learn to build a Rails API server for a simple review system with users, books, and reviews, including authentication and endpoints to create, update, delete, and fetch reviews.
Create a Rails api application using rails new rails-api --api, a lightweight project with only controller and model. Enable rack-cors security by uncommenting config/initializers/cors.rb and running bundle install.
Create a sign up function in api v1 registrations controller, permitting email, password, and password_confirmation. Return JSON with success or error status and set http codes, then test with Postman.
Test sign up with postman by sending a post request to rails api sign_up, including email, password, and password_confirmation, verify authentication_token, and observe error handling; refactor responses with json_response.
Learn to create a sign in API using Rails Devise, including a sessions controller, sign_in params, email lookup, password validation, and success responses with an authentication token.
Implement a logout API that deletes the session and generates a new authentication token; validate the token via the AUTH-TOKEN header, sign out with Devise, and respond with success.
Install the koala gem and create a new Facebook application. Configure koala with the app id and app secret for Graph API access and Facebook login in Rails 5.
Implement Facebook login via api: fetch user data with facebook_access_token, find or create user with email and uid, generate an auth token, and respond with json.
Test Facebook login by Postman, sending a post to localhost:3000/api/v1/facebook with a Facebook access token from the Graph API explorer, and prepare Authenticate.rb for the next task.
Define an authentication module to return the current_user from the authentication token, using the request headers auth-token, and implement authenticate_with_token! to enforce login across the app.
Create book and review models with Rails and migrate databases, establishing user and book associations with reviews. Implement before_save to compute average_rating as the float average of content_rating and recommend_rating.
generate fake data with the faker gem to seed 20 books, build an api v1 books controller with index and show, and configure routes to expose these endpoints.
Customize json responses with the AMS gem and ActiveModelSerializers by building serializable resources and serializers, adding computed fields like average_rating_of_book and content_rating_of_book.
Implement a counter cache with the counter_culture gem to store a book’s reviews_count, replacing live counts, and reduce database queries from twenty to one for faster Rails performance.
Implement eager loading to boost performance by reducing database queries. Use the Bullet gem to detect N+1 queries and include reviews when loading books, consolidating via the in operator.
Learn to upload images via a Rails API using the Paperclip gem, including base64 decoding and saving styled pictures (medium and thumb) to public/system/reviews/pictures.
Learn how to use Ruby On Rails 5 to build a professional REST API Server
This is course for you.
You'll be able to...
Don't wait, and enroll today to take another step toward web services mastery!
I hope to hear from you soon, and look forward to having you in my course!
P/s: This course has English subtitle. So don't worry!