1
0
Fork 0

Create a basic application

This commit is contained in:
Alex Kotov 2023-02-05 03:43:57 +04:00
parent 357935d3da
commit 10df142c93
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 27 additions and 0 deletions

View File

@ -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'

View File

@ -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)

21
main.rb Executable file
View File

@ -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