feat: Serve static assets of apps

This commit is contained in:
Faruk AYDIN
2021-10-19 16:29:37 +02:00
committed by Ali BARIN
parent 5a2de1de9e
commit 672cc4c60c
17 changed files with 118 additions and 23 deletions

View File

@@ -11,7 +11,9 @@ type AppConfig = {
postgresPort: number,
postgresHost: string,
postgresUsername: string,
postgresPassword: string
postgresPassword: string,
baseUrl?: string
webAppUrl?: string
}
const appConfig: AppConfig = {
@@ -27,4 +29,10 @@ const appConfig: AppConfig = {
postgresPassword: process.env.POSTGRESS_PASSWORD,
}
const webAppUrl = `${appConfig.protocol}://${appConfig.host}:${appConfig.corsPort}`;
appConfig.webAppUrl = webAppUrl;
const baseUrl = `${appConfig.protocol}://${appConfig.host}:${appConfig.port}`;
appConfig.baseUrl = baseUrl;
export default appConfig;

View File

@@ -1,7 +1,7 @@
import appConfig from './app'
const corsOptions = {
origin: `${appConfig.protocol}://${appConfig.host}:${appConfig.corsPort}`,
origin: appConfig.webAppUrl,
methods: 'POST',
credentials: true,
optionsSuccessStatus: 200,