Skip to content

Commit

Permalink
chore: remove CORS from backend API
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Feb 11, 2025
1 parent ab91169 commit 17bfad0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
2 changes: 0 additions & 2 deletions lib/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type EthereumConfig = RskConfig & {
type ApiConfig = {
host: string;
port: number;
cors?: string | string[];
};

type GrpcConfig = {
Expand Down Expand Up @@ -269,7 +268,6 @@ class Config {
api: {
host: '127.0.0.1',
port: 9001,
cors: '*',
},

grpc: {
Expand Down
12 changes: 0 additions & 12 deletions lib/api/Api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cors from 'cors';
import express, { Application, NextFunction, Request, Response } from 'express';
import { ApiConfig } from '../Config';
import Logger from '../Logger';
Expand All @@ -22,17 +21,6 @@ class Api {
this.app = express();
this.app.set('trust proxy', 'loopback');

if (config.cors === undefined || config.cors.length !== 0) {
this.app.use(
cors({
origin: config.cors || '*',
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
}),
);
}

this.app.use(
express.json({
verify(req, _, buf: Buffer, encoding: string) {
Expand Down
13 changes: 1 addition & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"bolt11": "^1.4.1",
"boltz-core": "^2.2.1",
"colors": "^1.4.0",
"cors": "^2.8.5",
"ecpair": "^2.1.0",
"ethers": "^6.13.5",
"express": "^4.21.2",
Expand Down

0 comments on commit 17bfad0

Please sign in to comment.