Sort out CORS

Signed-off-by: Karan Shah <karan.shah@simplybusiness.co.uk>
This commit is contained in:
Karan Shah
2022-02-11 16:19:43 +00:00
parent 58a801eefc
commit 938c7ff213
@@ -45,7 +45,11 @@ export async function startStandaloneServer(
.setPort(options.port)
.addRouter('/api/airbrake', router);
if (options.enableCors) {
logger.info('CORS is enabled, limiting to localhost with port 3000');
service = service.enableCors({ origin: 'http://localhost:3000' });
} else {
logger.info('CORS is disabled, allowing all origins');
service = service.enableCors({ origin: '*' });
}
return await service.start().catch(err => {