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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user