In this video series we will build a Rails API from scratch. Backend APIs are useful for serving data to frontend applications, mobile apps or other backend services.
✨ Check out the new version of this video series, which has been updated for Rails 7 • Rails 7 API Tutorial - Create project and ...
📖 You can also purchase the eBook and code for the new Rails 7 tutorial - tomkadwill.gumroad.com/l/rails-api-tutorial
This video covers:
00:00 - Introduction
00:27 - Adding a request spec for authentication
02:29 - Adding an /authenticate route
03:34 - Adding an AuthenticationController with 'create' action
04:45 - Updating the spec to post username and password params
05:49 - Updating the spec to check the response code is :created
06:24 - Adding an expectation to check the response body contains a token
07:15 - Adding 'render :json' to the controller, with token and status
08:00 - Adding a test for the case where user doesn't provide username/password
10:36 - Using required params in the auth controller
12:06 - Adding a rescue_from block to catch ParameterMissing and return error response
14:08 - Adding expectation to check the response body includes missing param message
If you’re new to this series, you may want to start with part 1: • Rails 6 API Tutorial - Create project and ...
コメント