Create a basic application
This commit is contained in:
parent
357935d3da
commit
10df142c93
2
Gemfile
2
Gemfile
|
@ -2,5 +2,7 @@
|
|||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'connection_pool', '~> 2.3'
|
||||
gem 'pg', '~> 1.4'
|
||||
gem 'puma', '~> 6.0'
|
||||
gem 'sinatra', '~> 3.0'
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
connection_pool (2.3.0)
|
||||
mustermann (3.0.0)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
nio4r (2.5.8)
|
||||
pg (1.4.5)
|
||||
puma (6.0.2)
|
||||
nio4r (~> 2.0)
|
||||
rack (2.2.6.2)
|
||||
|
@ -21,6 +23,8 @@ PLATFORMS
|
|||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
connection_pool (~> 2.3)
|
||||
pg (~> 1.4)
|
||||
puma (~> 6.0)
|
||||
sinatra (~> 3.0)
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'connection_pool'
|
||||
require 'pg'
|
||||
require 'sinatra'
|
||||
|
||||
$DB_POOL = ConnectionPool.new size: 5, timeout: 5 do
|
||||
PG.connect(
|
||||
host: 'pg.causa-arcana.com',
|
||||
dbname: 'leqsikoni',
|
||||
user: 'leqsikoni',
|
||||
password: 'ggeucene3ou7mqh2upehhm52tfp5bkcj',
|
||||
)
|
||||
end
|
||||
|
||||
get '/' do
|
||||
$DB_POOL.with do |db_conn|
|
||||
db_conn.exec('SELECT * FROM languages').to_a.inspect
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue