Member-only story

ReadIt a Simple Content Curation platform build with Rails API Backend and Vanilla Javascript

Peter Ayeni
11 min readJan 31, 2020

Ruby on Rails is a complete framework for building a full-stack web application used by many big organisations. In this blog post, I am going to be taking you through building an API with Ruby on Rails and consuming the API with a vanilla JavaScript FrontEnd.

The Backend

Building an API with Rails is now a first-hand citizen from Rails 5 that means you can pass in — API flag and get many of the boilerplates removed and get all you need for API only. Getting started with our project. ReadIt is a simple platform that allows users to submit interesting stories they found online.

rails new readit — api

This will generate a scaffold Ruby on rails app that is API specifics then in the Gemfile I uncomment the ‘rack-cors’ and also added faker for generating fake user content for our seed data. The run bundle install

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.1'# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.2', '>= 6.0.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
#…

--

--

Peter Ayeni
Peter Ayeni

Written by Peter Ayeni

Senior Frontend Engineer. I change the world by helping people get started in Tech and Social Entrepreneurship.

No responses yet