Nodes and Topics at http interface
This commit is contained in:
1 parent
b869b1459e
commit
8cd724fe93
2 files changed
+28
-10
No files matched your search
+26
-8
@@ -311,16 +311,25 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
try {
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestParameters[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
fs.rmdirSync(filePath, { recursive: true })
|
||||
fs.mkdirSync(filePath)
|
||||
|
||||
for (let i = 0; i < docsSchema.length; i++) {
|
||||
let schemaDocument = docsSchema[i]
|
||||
let fileContent = JSON.stringify(schemaDocument)
|
||||
let fileName = schemaDocument.type.toLowerCase().replaceAll(' ', '-') + '.json'
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes'
|
||||
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
|
||||
|
||||
let fileName = schemaDocument.type.toLowerCase()
|
||||
for (let j = 0; j < 10; j++) {
|
||||
fileName = fileName.replace(' ', '-')
|
||||
}
|
||||
fileName = fileName + '.json'
|
||||
|
||||
fs.writeFileSync(filePath + '/' + fileName, fileContent)
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
} catch (err) {
|
||||
@@ -388,16 +397,25 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
try {
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestParameters[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
fs.rmdirSync(filePath, { recursive: true })
|
||||
fs.mkdirSync(filePath)
|
||||
|
||||
for (let i = 0; i < docsSchema.length; i++) {
|
||||
let schemaDocument = docsSchema[i]
|
||||
let fileContent = JSON.stringify(schemaDocument)
|
||||
let fileName = schemaDocument.type.toLowerCase().replaceAll(' ', '-') + '.json'
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics'
|
||||
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
|
||||
|
||||
let fileName = schemaDocument.type.toLowerCase()
|
||||
for (let j = 0; j < 10; j++) {
|
||||
fileName = fileName.replace(' ', '-')
|
||||
}
|
||||
fileName = fileName + '.json'
|
||||
|
||||
fs.writeFileSync(filePath + '/' + fileName, fileContent)
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user