From 7bc45eb530f7b19eab4226d3872cd143480299a8 Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 27 Jan 2020 13:19:08 +0100 Subject: [PATCH] Fix root error in sendFile --- packages/siaviewnode-server/src/main.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/siaviewnode-server/src/main.ts b/packages/siaviewnode-server/src/main.ts index fafdc5bf..ce3a499f 100644 --- a/packages/siaviewnode-server/src/main.ts +++ b/packages/siaviewnode-server/src/main.ts @@ -5,7 +5,6 @@ import fileUpload, { UploadedFile } from "express-fileupload" import proxy from "express-http-proxy" import requestId from "express-request-id" import morgan from 'morgan' -import path from "path" import R from "ramda" import shortid from "shortid" import { Logger } from "winston" @@ -132,7 +131,7 @@ export class Server { "/web/:hash", (req: Request, res: Response) => { const { hash } = req.params this.logger.info(`GET /web/:hash -> ${hash}`) - res.sendFile(path.join(__dirname + '/testing.html')); + res.sendFile('testing.html', { root: __dirname }); } ) @@ -140,7 +139,7 @@ export class Server { "/:hash", (req: Request, res: Response) => { const { hash } = req.params this.logger.info(`GET /:hash -> ${hash}`) - res.sendFile(path.join(__dirname + '/testing.html')); + res.sendFile('testing.html', { root: __dirname }); } )