-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
282 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
const { contentNotFoundError404 } = require('validation'); | ||
const {contentNotFoundError404} = require('validation'); | ||
const guillotineLib = require('/lib/guillotine'); | ||
const {CORS_HEADERS} = require("../cors-headers"); | ||
|
||
|
||
|
||
exports.executeResult = (siteId, branch, query, variables) => { | ||
// TODO: app repo is targeted - should that be overridable? | ||
const content = guillotineLib.execute({ query, variables, siteId, branch }); | ||
const content = guillotineLib.execute({query, variables, siteId, branch}); | ||
|
||
return contentNotFoundError404(content, variables, query) || | ||
{ | ||
status: 200, | ||
body: content, | ||
contentType: 'application/json', | ||
headers: CORS_HEADERS | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exports.CORS_HEADERS = { | ||
'Access-Control-Allow-Headers': 'Content-Type', | ||
'Access-Control-Allow-Methods': 'POST, OPTIONS', | ||
'Access-Control-Allow-Origin': '*' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const project = 'hmdb'; // <-- project identifier in path, e.g. 'default' in the URL <domain>/site/default/master | ||
const appKey = "com.enonic.nextpoc.hmdb"; // <-- full app key = appName in hmdb/gradle.properties | ||
|
||
const appKeyUnderscored = appKey.replace(/\./g, '_'); | ||
const appKeyDashed = appKey.replace(/\./g, '-'); | ||
|
||
const apiDomain = "http://localhost:8080"; | ||
|
||
const apiContentBase = '_contentbase'; | ||
const apiContentFull = '_content'; | ||
|
||
const siteRootUrlMaster = `${apiDomain}/site/${project}/master`; | ||
const siteRootUrlDraft = `${apiDomain}/site/${project}/draft`; | ||
|
||
// appName is the content _name of the root site content-item: | ||
const contentApiUrlGetters = { | ||
master: { | ||
base: (appName) => `${siteRootUrlMaster}/${appName}/${apiContentBase}`, | ||
full: (appName) => `${siteRootUrlMaster}/${appName}/${apiContentFull}` | ||
}, | ||
draft: { | ||
base: (appName) => `${siteRootUrlDraft}/draft/${appName}/${apiContentBase}`, | ||
full: (appName) => `${siteRootUrlDraft}/draft/${appName}/${apiContentFull}` | ||
} | ||
}; | ||
|
||
module.exports = { | ||
project, | ||
appKey, | ||
appKeyUnderscored, | ||
appKeyDashed, | ||
apiDomain, | ||
apiContentBase, | ||
apiContentFull, | ||
siteRootUrlDraft, | ||
siteRootUrlMaster, | ||
contentApiUrlGetters | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
const {apiDomain} = require("./enonic.connection.config"); | ||
|
||
module.exports = { | ||
reactStrictMode: true, | ||
async headers() { | ||
return [ | ||
{ | ||
source: '/:contentPath*', | ||
headers: [ | ||
{ | ||
key: 'Access-Control-Allow-Origin', | ||
value: "*", | ||
}, | ||
{ | ||
key: 'Access-Control-Allow-Headers', | ||
value: "Content-Type", | ||
}, | ||
{ | ||
key: 'Access-Control-Allow-Methods', | ||
value: "GET,POST,OPTIONS", | ||
}, | ||
], | ||
}, | ||
] | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.