а
Size: a a a
S
а
local server = require 'http.server'
local sql = require 'tarantool_psql'
local json = require 'json'
local db = sql.connect{ host = '127.0.0.1', port = 5432, user = '', password = '', dbname = '', sslmode = 'disable', connections = 128, }
local httpd = server.new('127.0.0.1', arg[1])
httpd:route({path = '/.*'}, function(req)
local link = db.pool.get()
local query, result = link:query("select * from users")
db.pool:put(link)
return {status=200, body=json.encode(result)}
end)
httpd:start()
S
S
local server = require 'http.server'
local sql = require 'tarantool_psql'
local json = require 'json'
local db = sql.connect{ host = '127.0.0.1', port = 5432, user = '', password = '', dbname = '', sslmode = 'disable', connections = 128, }
local httpd = server.new('127.0.0.1', arg[1])
httpd:route({path = '/.*'}, function(req)
local link = db.pool.get()
local query, result = link:query("select * from users")
db.pool:put(link)
return {status=200, body=json.encode(result)}
end)
httpd:start()
S
S