Today, we'll be building out a small Rails API with a parner! Remember to use pairing best practices as you go through the assignment.
- Map out your domain model and associations. Choose a belongs_to/has_many or a many-to-many relationship with two models with one join model.
- Create your new Rails API application without the default test framework.
rails new my-pokemon-api --api -T
- Add the gems you'll need (ActiveModelSerializer, Rack Cors).
- Setup you app to accept requests from other places using CORS by un-commenting the file in
config/initializers/cors.rb
- Build out full CRUD actions for one of your resources.
- Requests should be namespaced under
v1
. For example,/api/v1/pokemon
should render JSON data off all the Pokemon. - Use serializers to only send back reasonable data. For example,
created_at
andupdated_at
should probably not be included.