Rails API with FastJSON from Netflix

Photo by Tomas Anton Escobar on Unsplash

Project setup

rails new fjsonrail --api --skip-tests -d mysql
gem 'faker', '~> 1.9', '>= 1.9.3'
gem 'fast_jsonapi'
gem 'kaminari', '~> 0.17.0'

Preparing some data

rails g model Location name

Controllers

Serializer

rails g serializer Location name

That’s it

Rails.application.routes.draw do
resources :locations, only: [:index, :show]
end

--

--

developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store