Skip to content

Commit

Permalink
allow cors for did-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed May 31, 2024
1 parent 0135683 commit 21862f0
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Module } from '@nestjs/common';
import {
MiddlewareConsumer,
Module,
NestModule,
RequestMethod,
} from '@nestjs/common';

import * as cors from 'cors';

import { AppController } from './app.controller';
import { AppService } from './app.service';

Expand All @@ -18,4 +26,15 @@ import { UserModule } from './user/user.module';
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
@Module({ controllers: [AppController] })
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(cors())
//This one route will have its cors config overriden with the custom implementation
.forRoutes({
path: '.well-known/did-configuration.json',
method: RequestMethod.GET,
});
}
}

0 comments on commit 21862f0

Please sign in to comment.