1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

fix: adde validation + code improvement

This commit is contained in:
Saad Jutt
2022-03-16 04:53:07 +05:00
parent d6fa877941
commit 1ff6965dd2
8 changed files with 271 additions and 69 deletions

View File

@@ -1,11 +1,12 @@
import path from 'path'
import express from 'express'
import { folderExists } from '@sasjs/utils'
import { getTmpFilesFolderPath } from '../../utils'
const router = express.Router()
export const publishAppStream = (appLoc: string[]) => {
export const publishAppStream = async (appLoc: string[]) => {
const appLocUrl = encodeURI(appLoc.join('/'))
const appLocPath = appLoc.join(path.sep)
@@ -16,7 +17,10 @@ export const publishAppStream = (appLoc: string[]) => {
'webv'
)
router.use(`/${appLocUrl}`, express.static(pathToDeployment))
if (await folderExists(pathToDeployment)) {
router.use(`/${appLocUrl}`, express.static(pathToDeployment))
console.log('Serving Stream App: ', appLocUrl)
}
}
export default router