Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9582315
handle-request.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
handle-request.js
View Options
"use strict"
;
const
Sealious
=
require
(
"../../lib/main"
);
const
get_request_body
=
require
(
"./get-request-body.js"
);
const
http_to_subject_method
=
require
(
"./http-to-method-name.js"
);
const
error_to_boom
=
require
(
"./error-to-boom.js"
);
const
extract_context
=
require
(
"./extract-context.js"
);
const
handle_response
=
require
(
"./handle-response.js"
);
const
handle_error
=
require
(
"./handle-error.js"
);
function
handle_request
(
app
,
request
,
h
)
{
try
{
const
config
=
app
.
ConfigManager
.
get
(
"www-server"
);
var
path_elements
=
request
.
params
.
elements
.
split
(
"/"
);
var
action_name
=
http_to_subject_method
[
request
.
method
.
toUpperCase
()];
let
context
=
null
;
return
extract_context
(
app
,
request
)
.
then
(
function
(
_context
)
{
context
=
_context
;
let
body
=
get_request_body
(
context
,
request
);
return
app
.
run_action
(
context
,
path_elements
,
action_name
,
body
);
})
.
then
(
result
=>
handle_response
(
app
,
context
,
h
)(
result
))
.
catch
(
result
=>
handle_error
(
app
,
h
)(
result
));
}
catch
(
error
)
{
app
.
Logger
.
error
(
error
);
return
error
;
}
}
module
.
exports
=
handle_request
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 06:33 (6 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983893
Default Alt Text
handle-request.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment