Skip to content

bruchu/goliath_mongo_pg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Goliath example using mongo and pg

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published