cors allow all

pull/14/head
leonnicolas 4 years ago
parent aa256dd1f7
commit d281800251
No known key found for this signature in database
GPG Key ID: 088D0743E2B65C07

5
package-lock.json generated

@ -2996,6 +2996,11 @@
}
}
},
"express-cors": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/express-cors/-/express-cors-0.0.3.tgz",
"integrity": "sha1-XCWnjXvmmk/LCEEssnyN/HWIlr0="
},
"ext": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz",

@ -35,6 +35,7 @@
"crc": "^3.8.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-cors": "0.0.3",
"graphql": "^15.3.0",
"messagepack": "^1.1.12",
"pg": "^8.3.3",

@ -36,7 +36,7 @@ import workshopResolvers from './resolvers/workshopResolvers';
import { ActionLog } from './model/ActionLog';
import actionLogResolvers from './resolvers/actionLogResolvers';
import { ActionLogAPI } from './datasources/db/actionLogAPI';
const cors = require('express-cors');
require('dotenv').config();
const connOptions: ConnectionOptions = {
@ -135,7 +135,11 @@ const app = express();
app.post('/graphql', authenticate);
app.get(/\/graphql?&.*query=/, authenticate);
server.applyMiddleware({ app });
app.use(cors({
allowedOrigins: [
'*'
]
}));
app.listen(4000, async () => {
await userAPI.createDefinedPermissions().catch(
err => console.log(err));

Loading…
Cancel
Save