update de server.ts pour accepter les requetes externes
This commit is contained in:
parent
b136e5438f
commit
789bbbf81d
@ -62,6 +62,10 @@
|
|||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
|
"options": {
|
||||||
|
"host": "0.0.0.0",
|
||||||
|
"allowedHosts": ["abonentendeur.guams.fr"]
|
||||||
|
},
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { APP_BASE_HREF } from '@angular/common';
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
import { CommonEngine } from '@angular/ssr';
|
import { CommonEngine } from '@angular/ssr';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import cors from 'cors';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { dirname, join, resolve } from 'node:path';
|
import { dirname, join, resolve } from 'node:path';
|
||||||
import bootstrap from './src/main.server';
|
import bootstrap from './src/main.server';
|
||||||
@ -25,6 +26,12 @@ export function app(): express.Express {
|
|||||||
index: 'index.html',
|
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
|
// All regular routes use the Angular engine
|
||||||
server.get('**', (req, res, next) => {
|
server.get('**', (req, res, next) => {
|
||||||
const { protocol, originalUrl, baseUrl, headers } = req;
|
const { protocol, originalUrl, baseUrl, headers } = req;
|
||||||
|
Loading…
Reference in New Issue
Block a user