-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the output part of results path
- Loading branch information
Showing
17 changed files
with
300 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ ID=demoservice | |
|
||
PORT=80 | ||
|
||
LIMIT=1000 | ||
LIMIT=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import accepts from "accepts"; | ||
import output from "../../models/processes/output.js"; | ||
import utils from "../../utils/utils.js"; | ||
|
||
export function get(req, res) { | ||
// (ADR) /core/no-trailing-slash Leave off trailing slashes from URIs (if not, 404) | ||
// https://gitdocumentatie.logius.nl/publicatie/api/adr/#/core/no-trailing-slash | ||
if (utils.ifTrailingSlash(req, res)) return; | ||
|
||
var jobId = req.params.jobId; | ||
var outputId = req.params.outputId; | ||
|
||
var formatFreeUrl = utils.getFormatFreeUrl(req); | ||
var serviceUrl = utils.getServiceUrl(req); | ||
|
||
var accept = accepts(req); | ||
var format = accept.type(["json", "html"]); | ||
|
||
output.get(formatFreeUrl, format, jobId, outputId, function (err, content) { | ||
if (err) { | ||
res | ||
.status(err.httpCode) | ||
.json({ code: err.code, description: err.description }); | ||
return; | ||
} | ||
|
||
switch (format) { | ||
case "json": | ||
// Recommendations 10, Links included in payload of responses SHOULD also be | ||
// included as Link headers in the HTTP response according to RFC 8288, Clause 3. | ||
// This recommendation does not apply, if there are a large number of links included | ||
// in a response or a link is not known when the HTTP headers of the response are created. | ||
res.status(200).json(content); | ||
break; | ||
case `html`: | ||
// Recommendations 10, Links included in payload of responses SHOULD also be | ||
// included as Link headers in the HTTP response according to RFC 8288, Clause 3. | ||
// This recommendation does not apply, if there are a large number of links included | ||
// in a response or a link is not known when the HTTP headers of the response are created. | ||
res.status(200).render(`results`, { content, serviceUrl }); | ||
break; | ||
default: | ||
res.status(400).json({ | ||
code: "InvalidParameterValue", | ||
description: `${accept} is an invalid format`, | ||
}); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.