diff --git a/angular.json b/angular.json index 3a460e8..e537cd1 100644 --- a/angular.json +++ b/angular.json @@ -62,6 +62,10 @@ "defaultConfiguration": "production" }, "serve": { + "options": { + "host": "0.0.0.0", + "allowedHosts": ["abonentendeur.guams.fr"] + }, "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { diff --git a/server.ts b/server.ts index 1a0df5e..879c584 100644 --- a/server.ts +++ b/server.ts @@ -1,6 +1,7 @@ import { APP_BASE_HREF } from '@angular/common'; import { CommonEngine } from '@angular/ssr'; import express from 'express'; +import cors from 'cors'; import { fileURLToPath } from 'node:url'; import { dirname, join, resolve } from 'node:path'; import bootstrap from './src/main.server'; @@ -25,6 +26,12 @@ export function app(): express.Express { index: 'index.html', })); + + server.use(cors({ + origin: ['http://abonentendeur.guams.fr', 'http://localhost:4200'], + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', + credentials: true + })); // All regular routes use the Angular engine server.get('**', (req, res, next) => { const { protocol, originalUrl, baseUrl, headers } = req;