Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.31 KB

README.md

File metadata and controls

56 lines (41 loc) · 1.31 KB

Goliath Mongo Postgres Example

This is a simple toy example that accesses both mongo and postgres through a Goliath async webserver.

Much of the code was lifted and rearranged from these demos:

Reasons:

  • I was having some difficulties getting postgres + mongo to work (likely due to user error) at the same time in the Goliath framework.
  • I did not want to proxy to endpoint unless the rate limit was checked before hand
    • this appeared to be a short-coming of the previous Goliath::Rack::AsyncAroundware auth_and_rate_limit.rb implementation, which now looks to have been replaced by Goliath::Rack::BarrierAroundwareFactory.

Setup

Setup Database

This sets up gmp_development with a simple 'partners' table, with a key of "a"

% cd bin % bash setup_db.sh % bundle install

Run server

% bundle exec ruby mongo_pg.rb -sv

forwarding example

% curl -v 'http://localhost:9000/horoscope?app=a'

missing key example

% curl -v 'http://localhost:9000/horoscope?app=b'