Fix root error in sendFile

This commit is contained in:
PJ 2020-01-27 13:19:08 +01:00
parent b68052b475
commit 7bc45eb530
1 changed files with 2 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import fileUpload, { UploadedFile } from "express-fileupload"
import proxy from "express-http-proxy" import proxy from "express-http-proxy"
import requestId from "express-request-id" import requestId from "express-request-id"
import morgan from 'morgan' import morgan from 'morgan'
import path from "path"
import R from "ramda" import R from "ramda"
import shortid from "shortid" import shortid from "shortid"
import { Logger } from "winston" import { Logger } from "winston"
@ -132,7 +131,7 @@ export class Server {
"/web/:hash", (req: Request, res: Response) => { "/web/:hash", (req: Request, res: Response) => {
const { hash } = req.params const { hash } = req.params
this.logger.info(`GET /web/:hash -> ${hash}`) 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) => { "/:hash", (req: Request, res: Response) => {
const { hash } = req.params const { hash } = req.params
this.logger.info(`GET /:hash -> ${hash}`) this.logger.info(`GET /:hash -> ${hash}`)
res.sendFile(path.join(__dirname + '/testing.html')); res.sendFile('testing.html', { root: __dirname });
} }
) )