From 7b60743ab8faf3211f05f2ae1a6141f08fd008f6 Mon Sep 17 00:00:00 2001 From: William Chong Date: Tue, 17 Dec 2024 21:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Add=20cors=20for=20book?= =?UTF-8?q?store=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/package-lock.json | 1 + functions/package.json | 1 + src/server/api/routes/bookstore/index.js | 3 +++ 3 files changed, 5 insertions(+) diff --git a/functions/package-lock.json b/functions/package-lock.json index cc4053306..0858d6a55 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -29,6 +29,7 @@ "body-parser": "^1.18.3", "chokidar": "^3.5.3", "cookie-parser": "^1.4.4", + "cors": "^2.8.5", "cosmjs-types": "^0.8.0", "create-hash": "^1.2.0", "crisp-api": "^9.0.0", diff --git a/functions/package.json b/functions/package.json index 7063feee6..134e0630d 100644 --- a/functions/package.json +++ b/functions/package.json @@ -36,6 +36,7 @@ "body-parser": "^1.18.3", "chokidar": "^3.5.3", "cookie-parser": "^1.4.4", + "cors": "^2.8.5", "cosmjs-types": "^0.8.0", "create-hash": "^1.2.0", "crisp-api": "^9.0.0", diff --git a/src/server/api/routes/bookstore/index.js b/src/server/api/routes/bookstore/index.js index e74cf5904..639bb417e 100644 --- a/src/server/api/routes/bookstore/index.js +++ b/src/server/api/routes/bookstore/index.js @@ -1,4 +1,5 @@ const { Router } = require('express'); +const cors = require('cors'); const { IS_TESTNET } = require('../../../config/config'); @@ -11,6 +12,8 @@ const { handleRestfulError } = require('../../middleware/error'); const router = Router(); +router.use('/bookstore', cors({ origin: true })); + router.get('/bookstore/tags', async (req, res, next) => { try { const { limit: pageSize, offset } = req.query;