update de server.ts pour accepter les requetes externes

This commit is contained in:
Guams 2025-02-16 00:11:22 +01:00
parent b136e5438f
commit 524570345c

View File

@ -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;