Skip to content

Instantly share code, notes, and snippets.

View j4zzcat's full-sized avatar

Sharon Dagan j4zzcat

View GitHub Profile
@j4zzcat
j4zzcat / rack-rest-api-example.rb
Created January 2, 2017 11:24 — forked from peter/rack-rest-api-example.rb
An example of how to write a simple JSON REST API with a simplistic router directly on top of Rack (i.e. without the use of a framework like Sinatra).
#################################################################
#
# File: lib/api.rb
#
#################################################################
require 'user' # ActiveRecord model
# Connect to the db
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])