Skip to content

Commit

Permalink
feat(node-server): Pass options to the CORS middleware via corsOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
offirgolan authored Apr 27, 2020
1 parent ad603d3 commit 3d991f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/node-server/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ new Server({
});
```

### corsOptions

_Type_: `Object | Function`
_Default_: `undefined`

Options passed to the ([CORS](https://github.com/expressjs/cors)) middleware.

```js
new Server({
corsOptions: {
origin: 'http://localhost:4000',
credentials: true
}
});
```

## API Configuration

### recordingsDir
Expand Down
2 changes: 1 addition & 1 deletion packages/@pollyjs/node-server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Server {
constructor(config = {}) {
this.config = { ...DefaultConfig, ...config };
this.app = express();
this.app.use(cors());
this.app.use(cors(this.config.corsOptions));

if (!this.config.quiet) {
this.app.use(morgan('dev'));
Expand Down

0 comments on commit 3d991f5

Please sign in to comment.