mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 19:34:34 +00:00
chore: fix for development docker-compose
This commit is contained in:
@@ -27,10 +27,6 @@ app.use('/', webRouter)
|
||||
app.use('/SASjsApi', apiRouter)
|
||||
app.use(express.json({ limit: '50mb' }))
|
||||
|
||||
try {
|
||||
app.use(express.static(getWebBuildFolderPath()))
|
||||
} catch (err) {
|
||||
console.error('Unable to get web build')
|
||||
}
|
||||
app.use(express.static(getWebBuildFolderPath()))
|
||||
|
||||
export default connectDB().then(() => app)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import path from 'path'
|
||||
import { readFileSync } from 'fs'
|
||||
import * as https from 'https'
|
||||
import { configuration } from '../package.json'
|
||||
import appPromise from './app'
|
||||
|
||||
const keyPath = path.join('..', 'certificates', 'privkey.pem')
|
||||
@@ -13,9 +12,10 @@ const cert = readFileSync(certPath)
|
||||
appPromise.then((app) => {
|
||||
const httpsServer = https.createServer({ key, cert }, app)
|
||||
|
||||
httpsServer.listen(configuration.sasJsPort, () => {
|
||||
const sasJsPort = process.env.PORT ?? 5000
|
||||
httpsServer.listen(sasJsPort, () => {
|
||||
console.log(
|
||||
`⚡️[server]: Server is running at https://localhost:${configuration.sasJsPort}`
|
||||
`⚡️[server]: Server is running at https://localhost:${sasJsPort}`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -12,11 +12,8 @@ const codeToInject = `
|
||||
</script>`
|
||||
|
||||
webRouter.get('/', async (_, res) => {
|
||||
let indexHtmlPath: string
|
||||
|
||||
try {
|
||||
indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
|
||||
} catch (err) {
|
||||
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
|
||||
if (!(await fileExists(indexHtmlPath))) {
|
||||
return res.send('Web Build is not present')
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import appPromise from './app'
|
||||
import { configuration } from '../package.json'
|
||||
|
||||
appPromise.then((app) => {
|
||||
app.listen(configuration.sasJsPort, () => {
|
||||
const sasJsPort = process.env.PORT ?? 5000
|
||||
app.listen(sasJsPort, () => {
|
||||
console.log(
|
||||
`⚡️[server]: Server is running at http://localhost:${configuration.sasJsPort}`
|
||||
`⚡️[server]: Server is running at http://localhost:${sasJsPort}`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import path from 'path'
|
||||
import { getRealPath } from '@sasjs/utils'
|
||||
|
||||
export const getWebBuildFolderPath = () =>
|
||||
getRealPath(path.join(__dirname, '..', '..', '..', 'web', 'build'))
|
||||
path.join(__dirname, '..', '..', '..', 'web', 'build')
|
||||
|
||||
export const getTmpFolderPath = () =>
|
||||
process.driveLoc ?? getRealPath(path.join(process.cwd(), 'tmp'))
|
||||
|
||||
Reference in New Issue
Block a user