aboutsummaryrefslogtreecommitdiff
path: root/src/routes.ts
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2019-12-09 18:11:26 -0500
committerKevin J Hoerr <kjhoerr@protonmail.com>2019-12-09 18:11:26 -0500
commit85d646880e1e3fef1d9547b72c2d0107e3465d90 (patch)
treeaaa1b2e2347daf1fa277baf33a6b0bedf35c009d /src/routes.ts
parent05204ed4699f983887db85416dba9a387b1c235a (diff)
downloadao-coverage-85d646880e1e3fef1d9547b72c2d0107e3465d90.tar.gz
ao-coverage-85d646880e1e3fef1d9547b72c2d0107e3465d90.tar.bz2
ao-coverage-85d646880e1e3fef1d9547b72c2d0107e3465d90.zip
Add template process to serve bash file
Unfortunately, a static file can't really be used to serve the connection - the host address is needed to link back to the server. Only a light library is needed to handle the template file though, and if more are needed in the future it should be a non-trivial task to add them to the process. By default I'm configuring this to work with drone.io, since that is the CI that I personally will be using (most likely). It should be non-trivial to configure other CI to handle the script as well.
Diffstat (limited to 'src/routes.ts')
-rw-r--r--src/routes.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/routes.ts b/src/routes.ts
index becf4da..d429659 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -20,6 +20,14 @@ const logger = winston.createLogger(loggerConfig("HTTP"));
export default (metadata: Metadata): Router => {
const router = Router();
+ // serve script for posting coverage report
+ router.use(
+ "/bash",
+ express.static(path.join(HOST_DIR, "bash"), {
+ setHeaders: res => res.contentType("text/plain")
+ })
+ );
+
// Upload HTML file
router.post("/v1/:org/:repo/:branch/:commit.html", (req, res) => {
const { org, repo, branch, commit } = req.params;