add CORS to server, input appUrl

This commit is contained in:
Amruth Pillai
2022-12-16 15:04:08 +00:00
parent dbc46f27a3
commit 2ba6658a0b
4 changed files with 10 additions and 9 deletions

3
.gitpod.Dockerfile vendored
View File

@ -1,3 +0,0 @@
FROM gitpod/workspace-postgresql
RUN pg_start

View File

@ -1,8 +1,8 @@
tasks:
- name: Run a local PostgreSQL Database
- name: Run PostgreSQL Database
command: docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
- name: Restore .env file, or create a new one
- name: Restore Environment Variables
command: |
if [ -f .env ]; then
echo "Found .env in workspace"
@ -16,9 +16,10 @@ tasks:
fi
fi
- name: Set up dependencies, and run the development server
init: pnpm install
command: pnpm dev
- name: Install Project Dependencies
command: |
npx playwright install-deps
pnpm install
ports:
# PostgreSQL

1
scripts/generate-env.ts Normal file
View File

@ -0,0 +1 @@
console.log('Hello, World!');

View File

@ -10,8 +10,10 @@ const bootstrap = async () => {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
const configService = app.get(ConfigService);
const appUrl = configService.get<string>('app.url');
// Middleware
app.enableCors({ credentials: true });
app.enableCors({ origin: [appUrl], credentials: true });
app.enableShutdownHooks();
app.use(cookieParser());