mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Added CORS support to the v2 Content API (#10257)
no-issue When trying to use /api/v2/content from a different domain, the requests were failing with CORS errors. This doesn't use the shared cors middleware, because it should be open to all hosts, and not locked down via our whitelist or trusted domains.
This commit is contained in:
parent
31269de7c3
commit
dcfaecfe92
1 changed files with 3 additions and 0 deletions
|
@ -1,10 +1,13 @@
|
|||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const apiv2 = require('../../../../api/v2');
|
||||
const mw = require('./middleware');
|
||||
|
||||
module.exports = function apiRoutes() {
|
||||
const router = express.Router();
|
||||
|
||||
router.options('*', cors());
|
||||
|
||||
// ## Posts
|
||||
router.get('/posts', mw.authenticatePublic, apiv2.http(apiv2.posts.browse));
|
||||
router.get('/posts/:id', mw.authenticatePublic, apiv2.http(apiv2.posts.read));
|
||||
|
|
Loading…
Add table
Reference in a new issue