Add cors
This commit is contained in:
parent
8f3217f3cc
commit
09f740f86a
17
package-lock.json
generated
17
package-lock.json
generated
@ -92,6 +92,14 @@
|
|||||||
"tslib": "~2.1.0"
|
"tslib": "~2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@koa/cors": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@koa/cors/-/cors-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-7ulRC1da/rBa6kj6P4g2aJfnET3z8Uf3SWu60cjbtxTA5g8lxRdX/Bd2P92EagGwwAhANeNw8T8if99rJliR6Q==",
|
||||||
|
"requires": {
|
||||||
|
"vary": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@sindresorhus/is": {
|
"@sindresorhus/is": {
|
||||||
"version": "0.14.0",
|
"version": "0.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||||
@ -243,6 +251,15 @@
|
|||||||
"@types/koa": "*"
|
"@types/koa": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/koa__cors": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/koa__cors/-/koa__cors-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-gBetQR0DJ9JTG1YQoW33BADHCrDPJGiJUKUUcEPJwW1A2unzpIMhorEpXB6eMaaXTaqHLemcGnq3RmH9XaryRQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/koa": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/linkify-it": {
|
"@types/linkify-it": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.0.tgz",
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@graphql-tools/merge": "^6.2.9",
|
"@graphql-tools/merge": "^6.2.9",
|
||||||
"@graphql-tools/schema": "^6.2.4",
|
"@graphql-tools/schema": "^6.2.4",
|
||||||
|
"@koa/cors": "^3.1.0",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^15.5.0",
|
||||||
"graphql-tag": "^2.11.0",
|
"graphql-tag": "^2.11.0",
|
||||||
@ -21,6 +22,7 @@
|
|||||||
"@types/koa": "^2.13.0",
|
"@types/koa": "^2.13.0",
|
||||||
"@types/koa-bodyparser": "^4.3.0",
|
"@types/koa-bodyparser": "^4.3.0",
|
||||||
"@types/koa-router": "^7.4.1",
|
"@types/koa-router": "^7.4.1",
|
||||||
|
"@types/koa__cors": "^3.0.2",
|
||||||
"@types/markdown-it": "^10.0.3",
|
"@types/markdown-it": "^10.0.3",
|
||||||
"@types/physical-cpu-count": "^2.0.0",
|
"@types/physical-cpu-count": "^2.0.0",
|
||||||
"@types/stoppable": "^1.1.0",
|
"@types/stoppable": "^1.1.0",
|
||||||
|
@ -3,12 +3,17 @@ import { applyGraphQL } from "./graphql";
|
|||||||
import { typeDefs, resolvers } from "./graphql/index";
|
import { typeDefs, resolvers } from "./graphql/index";
|
||||||
import stoppable from "stoppable";
|
import stoppable from "stoppable";
|
||||||
|
|
||||||
|
import cors from "@koa/cors";
|
||||||
|
|
||||||
const runtime: { server: undefined | stoppable.StoppableServer } = {
|
const runtime: { server: undefined | stoppable.StoppableServer } = {
|
||||||
server: undefined,
|
server: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const app = new Application();
|
const app = new Application();
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
bodyParser({
|
bodyParser({
|
||||||
enableTypes: ["json"],
|
enableTypes: ["json"],
|
||||||
|
Loading…
Reference in New Issue
Block a user