Skip to content

Commit

Permalink
Schema validation: update HTTP sample 3
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyaksenov committed Aug 28, 2024
1 parent d6d0b63 commit cece8ac
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ local function apply(cfg)
if httpd then
httpd:stop()
end
httpd = require('http.server').new(cfg.host, cfg.port)
local cfg_with_defaults = listen_address_schema:apply_default(cfg)
local host = listen_address_schema:get(cfg_with_defaults, 'host')
local port = listen_address_schema:get(cfg_with_defaults, 'port')
httpd = require('http.server').new(host, port)
local response_headers = { ['content-type'] = 'application/json' }
httpd:route({ path = '/band/:id', method = 'GET' }, function(req)
local id = req:stash('id')
Expand Down

0 comments on commit cece8ac

Please sign in to comment.