index.ts: cors

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

@ -32,6 +32,7 @@
},
"dependencies": {
"apollo-server-express": "^2.17.0",
"cors": "^2.8.5",
"crc": "^3.8.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",

@ -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');
const cors = require('cors');
require('dotenv').config();
const connOptions: ConnectionOptions = {
@ -131,15 +131,11 @@ const server = new ApolloServer({
});
const app = express();
app.use(cors());
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