JaeHyeok Song

add cors module

......@@ -6,7 +6,7 @@ const fs = require("fs");
const morgan = require("koa-morgan");
const jwtMiddleware = require("./src/lib/jwtMiddleware");
const api = require("./src/api");
const cors = require('@koa/cors'); // for fix CORS Error
require("dotenv").config();
const app = new Koa();
......@@ -15,6 +15,7 @@ const accessLogStream = fs.createWriteStream(__dirname + "/access.log", {
flags: "a",
});
require("dotenv").config();
app.use(cors());
app.use(bodyParser());
app.use(jwtMiddleware);
app.use(morgan("combined", { stream: accessLogStream }));
......
......@@ -146,6 +146,14 @@
"to-fast-properties": "^2.0.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": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
......@@ -826,6 +834,15 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"cron-parser": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-2.15.0.tgz",
......
......@@ -4,11 +4,13 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@koa/cors": "^3.1.0",
"axios": "^0.19.2",
"bcrypt": "^4.0.1",
"body-parser": "^1.19.0",
"cheerio": "^1.0.0-rc.3",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"eslint-config-prettier": "^6.11.0",
"fs": "^0.0.1-security",
......