Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Latest commit

 

History

History

sinatra

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sinatra implementation

Pure JRuby implementation of the HTTP Requests Example using Sinatra.

Setup

  1. Install dependencies
$ bundle install
  1. Install PostgreSQL and start server locally

  2. Set up database:

$ createdb jruby_ratpack_example
  1. Initialize database schema
$ bundle exec rake db:init
  1. Populate database with seed data
$ bundle exec rake db:seed

Getting Started

  • Start the server

    $ bin/server
    
    # curl or visit in browser:
    http://localhost:5050
    
    # endpoints:
    http://localhost:5050/music   # db call
    http://localhost:5050/planets # http request to external api
    http://localhost:5050/*       # 404
  • Start the server using a local planets API

    $ PLANETS_URL="http://localhost:3000/planets" bin/server