Creating API without JSON

yeva USA
1 min readNov 3, 2021

With the progress that happens around us, we want to make sure that the process doesn't interfere with our security. Cyber threats became more popular, unfortunately. Therefore we have to create an API for our web applications without local directory access. JSON is a great tool, however, Active Record in Ruby and Sentra together create a safer and easier approach to communicate with different applications without any problems. Let's take as an example this part of the code:

# db/migrate/20210718144445_create_spells.rb
class CreateSpells < ActiveRecord::Migration[6.1]
def change
create_table :spells do |t|
t.string :name
t.integer :level
t.string :description
end
end
end

The code above represents the active record migration that takes in 3 values and creates a table with the types of values. It is convenient to do so in migrations and then seed data ( cleans existing database and creates a new one) then go back and forward with JSON file that can be changed by almost everyone.

Ruby also provides us in Active record with many tools that we can use on the created database. We can erase, create, add, filter, and do many other things to the table by using some simple commands. We don't even have to refer to React for those things anymore. The backend is more sufficient by using Active record with Sentra than JSON that holds everything in one directory.

--

--

yeva USA
0 Followers

Hello everyone! I am a student in full stuck code academy and a full time employee in medical office. Worked as animal rescue for some time.