Skip to content

Commit

Permalink
Merge pull request #31 from GeneralMagicio/fix-cors
Browse files Browse the repository at this point in the history
add cors
  • Loading branch information
ae2079 authored Aug 21, 2024
2 parents 06c72a7 + 18c73b2 commit 3f6fffc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"connect": "^3.7.0",
"connect-redis": "^7.1.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"csvtojson": "^2.0.10",
"dotenv": "^8.2.0",
"ethers": "^5.7.2",
Expand Down
4 changes: 3 additions & 1 deletion src/server/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Resource } from '@adminjs/typeorm';
import { validate } from 'class-validator';
import { ModuleThread, Pool, spawn, Worker } from 'threads';
import { DataSource } from 'typeorm';
// import cors from 'cors';
import cors from 'cors';
import bodyParser from 'body-parser';
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.js';
import { ApolloServerPluginLandingPageDisabled } from '@apollo/server/plugin/disabled';
Expand Down Expand Up @@ -169,6 +169,8 @@ export async function bootstrap() {
limit: (config.get('UPLOAD_FILE_MAX_SIZE') as number) || '5mb',
});

app.use(cors());

// To download email addresses of projects in AdminJS projects tab
app.get('/admin/download/:filename', (req, res) => {
const filename = req.params.filename;
Expand Down

0 comments on commit 3f6fffc

Please sign in to comment.